Skip to content

Instantly share code, notes, and snippets.

Avatar

Neil Alexander neilalexander

View GitHub Profile
@neilalexander
neilalexander / example.go
Created Jan 9, 2019
macOS/iOS: Writing to NSLog using Golang (using Cgo)
View example.go
package myapp
import "log"
...
mobilelog := MobileLogger{}
logger := log.New(mobilelog, "", 0)
View crawler.py
#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 Jul 13, 2017
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.
View deltadict.py
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 Jun 29, 2012
Some interesting code that will send a UDP packet to all available broadcast/point-to-point IPv4 addresses
View sendall.c
#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>
You can’t perform that action at this time.