Skip to content

Instantly share code, notes, and snippets.

View askldjd's full-sized avatar

Alan Ning askldjd

View GitHub Profile
@askldjd
askldjd / analyze-gen.rb
Created January 11, 2017 18:44
Look for a single generation of ruby heap and print out the allocation source.
require 'json'
class Analyzer
def initialize(filename)
@filename = filename
end
def analyze
data = []
File.open(@filename) do |f|
f.each_line do |line|
# Match on all types of devices but tablet devices and joysticks
Section "InputClass"
Identifier "libinput pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput keyboard catchall"
@askldjd
askldjd / socks-proxy.js
Created August 5, 2016 12:57
Quick POC for proxying S3
'use strict';
const socks = require('socksv5');
const srv = socks.createServer(function(info, accept, deny) {
accept();
});
srv.listen(50099, 'localhost', function() {
console.log('SOCKS server listening on port 50099');
});
@askldjd
askldjd / check-dups.js
Created June 6, 2016 02:18
Check duplicate NPM modules
'use strict';
const _ = require('lodash');
const spawn = require('child_process').spawn;
// Holds a list of all flattened packages used in this module
let packages = [];
/**
* Run through the npm dependencies object and recursively accumulate all
from scapy.all import *
def pkt_callback(pkt):
pkt.show() # debug statement
sniff(iface="eth0",
prn=pkt_callback, filter="ip", store=0)
import socket, struct, os, array
from scapy.all import ETH_P_ALL
from scapy.all import select
from scapy.all import MTU
class IPSniff:
def __init__(self, interface_name, on_ip_incoming, on_ip_outgoing):
self.interface_name = interface_name