Skip to content

Instantly share code, notes, and snippets.

View samsonjs's full-sized avatar

Sami Samhuri samsonjs

View GitHub Profile
var _0x120d = ["\x72\x61\x6E\x64\x6F\x6D", "\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C", "\x73\x68\x69\x66\x74\x53\x74\x61\x74\x65\x31", "\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64", "\x4F\x6E", "\x73\x68\x69\x66\x74\x53\x74\x61\x74\x65\x32", "\x4F\x66\x66"];
function explain() {
if (Math[_0x120d[0]]() > 0.5) {
document[_0x120d[3]](_0x120d[2])[_0x120d[1]] = _0x120d[4];
document[_0x120d[3]](_0x120d[5])[_0x120d[1]] = _0x120d[6];
} else {
document[_0x120d[3]](_0x120d[2])[_0x120d[1]] = _0x120d[6];
document[_0x120d[3]](_0x120d[5])[_0x120d[1]] = _0x120d[4];
};
asm.block do
# low nybble of nth byte
movzx(EBX, AL)
and_(BL, 0x0f) # isolate low nybble
movzx(EDX, [:byte, ESI+EBX])
mov([EDI], DL)
dec(EDI)
# high nybble of nth byte
movzx(EBX, AL)
and_(BL, 0xf0) # isolate high nybble
struct Base {
int type;
int flags;
};
struct Frobulator {
struct Base base; /* Frobulator begins with 2 ints for type and flags */
unsigned int frob_limit;
};
require 'cstruct'
class Base < CStruct
int :type
int :flags
end
class Frobulator < Base
uint :frob_limit
end
class Section < CStruct
string :sectname, 16
string :segname, 16
uint32 :addr
uint32 :size
uint32 :offset
uint32 :align
uint32 :reloff
uint32 :nreloc
uint32 :flags
# Appears at the beginning of every Mach object file.
class MachHeader < CStruct
uint32 :magic
int32 :cputype
int32 :cpusubtype
uint32 :filetype
uint32 :ncmds
uint32 :sizeofcmds
uint32 :flags
end
# Segment commands are one type of load command.
# Load commands all begin with the type of command it is, cmd,
# and the size of that command's struct in bytes.
class LoadCommand < CStruct
uint32 :cmd
uint32 :cmdsize
end
# Values for the cmd member of LoadCommand CStructs (incomplete).
urlRegex = /\b // 1. match a word boundary, i.e. whitespace or punctuation
( // 2. capture the entire URL
( [\w-]+:\/\/? | www[.] ) // 3. protocol:// or www.
[^\s()]+ // 4. anything that's not whitespace, a paren, or an angle bracket
(?: // 5. non-capturing group (this is the last thing matched)
\([\w\d]+\) // 6. trailing parenthesized word containing only alnums (wikipedia)
| // or
( [^-!"#$%&'()*+,./:;?@[\\\]^_`{|}~\s] // 7. [^[:punct:]\s] -- anything but punctuation or whitespace
| // or
\/ // 8. a trailing slash
#!/usr/bin/env zsh
git-pull-all-branches() {
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "$pwd is not part of a git repo"
return
fi
origbranch=$(git branch | fgrep '*' | sed -e 's/\* //')
bs=($@)
[[ -z "$bs" ]] && bs=($(git branch | sed -e 's/\* //'))
var sys = require("sys"),
http = require("http"),
port = 12345,
spawn = require("child_process").spawn;
function gzipStr (str, callback) {
var child = spawn("gzip", ["-c", "-f", "-n"]),
stdout = "", stderr = "";
child.stdout.addListener("data", function (chunk) {