This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = array(); | |
$b = array(); | |
for ($i = 0; $i <50; $i+=1) { | |
$a[$i] = $i; | |
$b[] = $i; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
if [ $# -eq 0 ] | |
then | |
echo "No word supplied" | |
fi | |
word=$1 | |
find . -type f -and -not -path '*/.git/*' -and -not -path '*/.svn/*' -exec grep -i -H "$word" {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pthread.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/types.h> | |
#define NUM_THREADS 4 | |
#define MAX_COUNT 10000000 | |
struct tdata { | |
int tid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* It will eat your memory | |
* But if you insist, compile it with: | |
gcc -pthread -fgnu-tm -mcx16 -o transaction_bomb transaction_bomb.c | |
*/ | |
#include <pthread.h> | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.exceptions import MiddlewareNotUsed | |
from django.conf import settings | |
import re | |
class BehindLB(object): | |
""" Middleware that get the real IP from de x-forwarded-for | |
Don't use it if you are not sure your load balancer return the real ip | |
BEHIND_LB_PATH = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.appengine.ext import ndb | |
from datetime import datetime, timedelta, date | |
# | |
# | |
# | |
class HostConnection(ndb.Model): | |
date = ndb.DateProperty() | |
host = ndb.StringProperty() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TREE = { | |
'proxy': { | |
'': proxy_list, | |
'list': (proxy_list, ("username", False)), | |
'info': (proxy_info, ("proxy_name", True)), | |
}, | |
'auth': { | |
'': auth_info, | |
'info': (auth_info, ("token", False)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (acl *ACL) checkServer(ip string) bool { | |
type Params struct { | |
IP string `url:"ip"` | |
Name string `url:"name"` | |
} | |
ops := requestOps // To check laer | |
if _, found := acl.rejected.Get(ip); found { | |
log.Printf("In rejected %s", ip) | |
return false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import numpy.random as npr | |
SIZE=3030 | |
LOOPS=1000000 | |
TIE=SIZE/2 | |
ties=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
""" Execute it several times to vary the biases, | |
which can be biased too | |
""" | |
import numpy.random as npr | |
SIZE=3030 | |
LOOP=1000000 |
OlderNewer