Forum rules
- Ask questions about or share code from languages other than Source Engine scripting.
- Start new topic titles with the code language in brackets (i.e. [C#], [C++], [PHP], etc.)
-
[GR]doodleninja
- 1000+ Posts
![1000+ Posts 1000+ Posts](./images/ranks/ForumRanks_8a.gif)
- Posts: 1086
- Joined: Mon Feb 27, 2012 11:08 am
Post
by [GR]doodleninja » Tue May 29, 2012 10:26 am
Code: Select all
struct group_info init_groups = { .usage = ATOMIC_INIT(2) };
struct group_info *groups_alloc(int gidsetsize){
struct group_info *group_info;
int nblocks;
int i;
nblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK;
/* Make sure we always allocate at least one indirect block pointer */
nblocks = nblocks ? : 1;
group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER);
if (!group_info)
return NULL;
group_info->ngroups = gidsetsize;
group_info->nblocks = nblocks;
atomic_set(&group_info->usage, 1);
if (gidsetsize <= NGROUPS_SMALL)
group_info->blocks[0] = group_info->small_block;
else {
for (i = 0; i < nblocks; i++) {
gid_t *b;
b = (void *)__get_free_page(GFP_USER);
if (!b)
goto out_undo_partial_alloc;
group_info->blocks[i] = b;
}
}
return group_info;
out_undo_partial_alloc:
while (--i >= 0) {
free_page((unsigned long)group_info->blocks[i]);
}
kfree(group_info);
return NULL;
}
EXPORT_SYMBOL(groups_alloc);
void groups_free(struct group_info *group_info)
{
if (group_info->blocks[0] != group_info->small_block) {
int i;
for (i = 0; i < group_info->nblocks; i++)
free_page((unsigned long)group_info->blocks[i]);
how is this?
-
Nicdel
- Server Admin
- Posts: 2417
- Joined: Sun Apr 11, 2010 4:50 am
Post
by Nicdel » Tue May 29, 2012 11:28 am
If you feel cool just because you posted a part of the linux kernel, you're a faggot.
Ingame: -[SaD]- Nico
![Image](https://www.area51servers.com/imageserver.php?url=http://www.mcrs.eu/AEyyr1u.gif&hash=4370c084f35915f156aee2187e40e6b3&cache=0840)
-
[GR]doodleninja
- 1000+ Posts
![1000+ Posts 1000+ Posts](./images/ranks/ForumRanks_8a.gif)
- Posts: 1086
- Joined: Mon Feb 27, 2012 11:08 am
Post
by [GR]doodleninja » Tue May 29, 2012 11:36 am
http://www.hackertyper.com/
type random shit. it will turn into code
-
Nicdel
- Server Admin
- Posts: 2417
- Joined: Sun Apr 11, 2010 4:50 am
Post
by Nicdel » Tue May 29, 2012 11:39 am
Always the same code. From the linux kernel.
http://www.hackertyper.com/code.txt
Ingame: -[SaD]- Nico
![Image](https://www.area51servers.com/imageserver.php?url=http://www.mcrs.eu/AEyyr1u.gif&hash=4370c084f35915f156aee2187e40e6b3&cache=0840)
-
[GR]doodleninja
- 1000+ Posts
![1000+ Posts 1000+ Posts](./images/ranks/ForumRanks_8a.gif)
- Posts: 1086
- Joined: Mon Feb 27, 2012 11:08 am
Post
by [GR]doodleninja » Tue May 29, 2012 11:44 am
ik. where did you learn so much 'bout pc
-
Nicdel
- Server Admin
- Posts: 2417
- Joined: Sun Apr 11, 2010 4:50 am
Post
by Nicdel » Tue May 29, 2012 12:05 pm
[GR]doodleninja wrote:ik. where did you learn so much 'bout pc
By myself.
Ingame: -[SaD]- Nico
![Image](https://www.area51servers.com/imageserver.php?url=http://www.mcrs.eu/AEyyr1u.gif&hash=4370c084f35915f156aee2187e40e6b3&cache=0840)
-
killman2639
- Former Server Admin
- Posts: 292
- Joined: Mon Aug 23, 2010 8:41 pm
Post
by killman2639 » Thu May 31, 2012 10:44 pm
Nicdel wrote:[GR]doodleninja wrote:ik. where did you learn so much 'bout pc
By myself.
Best way
![Uber Geek :ugeek:](./images/smilies/icon_e_ugeek.gif)
Hi, I'm Reloaded. :)
Code: Select all
[GR|CMX] Reelawded | Reloaded : hi, im black
[GR|CMX] Reelawded | Reloaded : shit
Disconnect: being black.
Disconnect: being black.
-
Jack
- Former Server Admin
- Posts: 1248
- Joined: Fri Apr 09, 2010 4:01 pm
- Location: Norway, Oslo
Post
by Jack » Sat Jun 02, 2012 4:03 pm
Code: Select all
public class QuickF
{ public static void main(String[] args)
{ int N = Integer.parseInt(args[0]);
int id[] = new int[N];
for (int i = 0; i < N ; i++) id[i] = i;
for( In.init(); !In.empty(); )
{ int p = In.getInt(), q = In.getInt();
int t = id[p];
if (t == id[q]) continue;
for (int i = 0; i < N; i++)
if (id[i] == t) id[i] = id[q];
Out.println(" " + p + " " + q);
}
}
}
-----
int i, j, p = In.getInt(), q = In.getInt();
for (i = p; i != id[i]; i = id[i]);
for (j = q; j != id[j]; j = id[j]);
if (i == j) continue;
id[i] = j;
Out.println(" " + p + " " + q);
-----
public class QuickUW
{ public static void main(String[] args)
{ int N = Integer.parseInt(args[0]);
int id[] = new int[N], sz[] = new int[N];
for (int i = 0; i < N ; i++)
{ id[i] = i; sz[i] = 1; }
for(In.init(); !In.empty(); )
{ int i, j, p = In.getInt(), q = In.getInt();
for (i = p; i != id[i]; i = id[i]);
for (j = q; j != id[j]; j = id[j]);
if (i == j) continue;
if (sz[i] < sz[j])
{ id[i] = j; sz[j] += sz[i]; }
else { id[j] = i; sz[i] += sz[j]; }
Out.println(" " + p + " " + q);
}
}
}
-----
for (i = p; i != id[i]; i = id[i])
id[i] = id[id[i]];
for (j = q; j != id[j]; j = id[j])
id[j] = id[id[j]];
static int search(int a[], int v, int l, int r)
{ int i;
for (i = l; i <= r; i++)
if (v == a[i]) return i;
return -1;
}
-----
static int search(int a[], int v, int l, int r)
{
while (r >= l)
{ int m = (l+r)/2;
if (v == a[m]) return m;
if (v < a[m]) r = m-1; else l = m+1;
}
return -1;
}
omaigad, im a hacker now.
and i got no idea what the fuck this shit is
-
Cookie
- 50+ Posts
![50+ Posts 50+ Posts](./images/ranks/ForumRanks_3a.gif)
- Posts: 99
- Joined: Fri May 25, 2012 12:47 pm
- Location: France
Post
by Cookie » Mon Jun 04, 2012 11:15 am
[GR]doodleninja wrote:Code: Select all
struct group_info init_groups = { .usage = ATOMIC_INIT(2) };
struct group_info *groups_alloc(int gidsetsize){
struct group_info *group_info;
int nblocks;
int i;
nblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK;
/* Make sure we always allocate at least one indirect block pointer */
nblocks = nblocks ? : 1;
group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER);
if (!group_info)
return NULL;
group_info->ngroups = gidsetsize;
group_info->nblocks = nblocks;
atomic_set(&group_info->usage, 1);
if (gidsetsize <= NGROUPS_SMALL)
group_info->blocks[0] = group_info->small_block;
else {
for (i = 0; i < nblocks; i++) {
gid_t *b;
b = (void *)__get_free_page(GFP_USER);
if (!b)
goto out_undo_partial_alloc;
group_info->blocks[i] = b;
}
}
return group_info;
out_undo_partial_alloc:
while (--i >= 0) {
free_page((unsigned long)group_info->blocks[i]);
}
kfree(group_info);
return NULL;
}
EXPORT_SYMBOL(groups_alloc);
void groups_free(struct group_info *group_info)
{
if (group_info->blocks[0] != group_info->small_block) {
int i;
for (i = 0; i < group_info->nblocks; i++)
free_page((unsigned long)group_info->blocks[i]);
how is this?
![Image](https://www.area51servers.com/imageserver.php?url=http://www.fairfaxunderground.com/forum/file.php?40,file=32686,filename=get_the_fuck_out.jpg&hash=bc095bf9eb296882dbe1afffc49440f1&cache=0840)
-
MAMALUIGI
- 50+ Posts
![50+ Posts 50+ Posts](./images/ranks/ForumRanks_3a.gif)
- Posts: 87
- Joined: Thu Aug 25, 2011 12:11 am
Post
by MAMALUIGI » Thu Jul 12, 2012 5:33 am
doodle ninja is like a newfag that stays a newfag forever. Ive been reading retarded topics and replies from this guy for about 6 months.
-
awesomedude
- Former Server Admin
- Posts: 804
- Joined: Sun Jan 15, 2012 6:37 pm
Post
by awesomedude » Thu Jul 12, 2012 5:50 am
MAMALUIGI wrote:doodle ninja is like a newfag that stays a newfag forever. Ive been reading retarded topics and replies from this guy for about 6 months.
Well you obviously haven't been reading enough. Don't comment on month-old threads.
Just for the record: I agree with you.
Shit happens
-
[GR]doodleninja
- 1000+ Posts
![1000+ Posts 1000+ Posts](./images/ranks/ForumRanks_8a.gif)
- Posts: 1086
- Joined: Mon Feb 27, 2012 11:08 am
Post
by [GR]doodleninja » Fri Jul 13, 2012 5:53 am
Me too