Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am sitwon on github.
  • I am sitwon (https://keybase.io/sitwon) on keybase.
  • I have a public key whose fingerprint is 016D 2854 B61F 1154 50BA EC08 C728 E6C6 3233 ED30

To claim this, I am signing this object:

@Sitwon
Sitwon / pasteit.sh
Created April 27, 2010 01:36
Simple script for pasting stuff to pastebin.com from the command line
#!/bin/bash
ADDRESS="http://pastebin.com/api_public.php"
NAME=${NAME:-$USER}
URL=$(curl -d paste_private=1 -d "paste_code=$(cat $1)" -d "paste_name=$NAME" $FORMAT $SUBDOMAIN $ADDRESS 2>/dev/null)
echo $URL
abstract class Lambda {
abstract public void func();
}
public class Example {
public static void main(String args[]) {
System.out.println("Begin main");
final String hello = "Hello World!";
functionCall(new Lambda() {
public void func() {
<?xml version="1.0"?>
<document>
<item a="0" b="0" c="0" name="0"/>
<item a="1" b="0" c="0" name="1"/>
<item a="0" b="1" c="0" name="2"/>
<item a="1" b="1" c="0" name="3"/>
<item a="0" b="0" c="1" name="4"/>
<item a="1" b="0" c="1" name="5"/>
<item a="0" b="1" c="1" name="6"/>
<item a="1" b="1" c="1" name="7"/>
public class MergeSort {
public static void main(String[] args) {
int[] list = {8,3,6,2,7,1,9,4,10,5};
printArray(list);
mergeSort(list, 0, list.length - 1);
}
public static void printArray(int[] array) {
System.out.print("{");
for (int i = 0 ; i < array.length ; i++) {
@Sitwon
Sitwon / bucket_finder.rb
Created June 28, 2011 01:30
Thread pooled bucket finder (untested). Requires: gem install actionpool
#!/usr/bin/env ruby
# == Bucket Finder - Trawl Amazon S3 buckets for interesting files
#
# Each group of files on Amazon S3 have to be contained in a bucket and each bucket has to have a unique
# name across the system. This means that it is possible to bruteforce names, this script does this and more
#
# For more information on how this works see my blog post "Whats in Amazon's buckets?" at
# http://www.digininja.org/blog/whats_in_amazons_buckets.php
#
@Sitwon
Sitwon / package-list.txt
Created July 11, 2011 00:25
Non-Slackware packages from the Porteus base
broadcom-sta-5.100.82.38-i486-1ftm
ndiswrapper-1.56-i486-1ftm
atmel-firmware-1.3-fw-1ftm
b43-firmware-4.174.64.19-fw-1ftm
extra-firmware-pack-0.1-fw-1ftm
ipw3945-ucode-1.14.2-fw-1ftm
libertas-firmware-20101019-fw-1ftm
p7zip-9.13-i486-1ftm
rar-4.0.0-i486-1ftm
slackyd-1.0-i486-1ftm
@Sitwon
Sitwon / Makefile
Created July 15, 2011 01:42
A mystery...
PKGS= newfileA newfileB
DIRS= a b c
all: $(PKGS)
$(DIRS):
mkdir -p $@
$(PKGS): %: c/%
@Sitwon
Sitwon / halfwayhouse.c
Created July 18, 2011 22:07
Not mine, it was on an invite to one of their parties.
/* Hacker Halfway House */
#include <stdio.h>
int main(){int b,i=6,h[]={0xfffffbdf,0x7bde,
0x7bde,0,0x7bde,0x7bde,0xfffffbdf,
0x4861636b,0x65722048,0x616c6677,0x61792048,
0x6f757365,0};while(h[++i]&&ntohl(1)!=1)
h[i]=ntohl(h[i]);while(1){for(i=0;i<0xe0;
i++){if(!(i%32))puts("");b=(rand()>>(i%30))
%2;if((((i%32)>7)&&!(h[i/32]&(1<<((i%32)-8))
@Sitwon
Sitwon / bitsToMask.bash
Last active December 31, 2015 04:39
A function for converting mask bits to a mask address. For example: 32 => 255.255.255.255 24 => 255.255.255.0 22 => 255.255.252.0
#!/bin/bash
bitsToMask(){
trace_log "bitsToMask" "$@"
if [ "$#" -eq 1 ]; then
bitsToMask "${1}" 0 ""
elif [ "${2}" -eq 4 ]; then
echo "${3%.}"
else
local BITS=${1}