This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn -main [& args] | |
(if (nth args 0) | |
(bf-interpreter (slurp (nth args 0))) | |
(println "Please specify a brainfuck file as the first argument"))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Redirect user tracking test</title> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
capture_session.stream.each { |packet| | |
puts "Woohoo I found a cookie" if packet =~ /ookie/ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
capture_session = PacketFu::Capture.new(:iface => 'eth0', :start => true, :promisc => true, :filter => "tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<>2)) != 0)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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^^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn palindrome? [s] | |
(= (reverse (str s) ) (seq (str s)))) | |
(apply max | |
(filter palindrome? | |
(for | |
[a (range 100 1000) | |
b (range 100 1000)] | |
(* a b)))) |