Skip to content

Instantly share code, notes, and snippets.

View neilalexander's full-sized avatar

Neil neilalexander

View GitHub Profile
@neilalexander
neilalexander / example.go
Created January 9, 2019 22:44
macOS/iOS: Writing to NSLog using Golang (using Cgo)
package myapp
import "log"
...
mobilelog := MobileLogger{}
logger := log.New(mobilelog, "", 0)
@neilalexander
neilalexander / crawler.py
Created December 27, 2018 23:14
Yggdrasil crawler
#some of this code was contributed by Arcelier
#original code https://github.com/Arceliar/yggdrasil-map/blob/master/scripts/crawl-dht.py
#multithreaded by neilalexander
import psycopg2
import json
import socket
import sys
import time
import ipaddress
@neilalexander
neilalexander / deltadict.py
Last active July 13, 2017 07:40
Python 3 functions for comparing complex dict structures for additions, changes and deletions, and for walking the tree and running a given function on nodes.
class DeltaDict:
#
# changes(dict1, dict2) returns dict
#
# Finds nodes that appear in both dict1 and dict2 but
# where the values have changed
#
def changes(d1, d2):
d = dict()
s = set(d1.keys()).intersection(set(d2.keys()))
@neilalexander
neilalexander / sendall.c
Created June 29, 2012 19:07
Some interesting code that will send a UDP packet to all available broadcast/point-to-point IPv4 addresses
#include <sys/socket.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <ifaddrs.h>
#include <stdlib.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>