Skip to content

Instantly share code, notes, and snippets.

View zakird's full-sized avatar

Zakir Durumeric zakird

View GitHub Profile
import sys
from cymru import CymruIPtoASNService
a = CymruIPtoASNService()
queries = []
with open(sys.argv[1]) as fd:
i = 0
for l in fd:
@zakird
zakird / gist:11196064
Created April 22, 2014 22:06
cymru.py
#!/usr/bin/env python
# encoding: utf-8
"""
cymru.py
"""
import sys
import os
import socket
import unittest
@zakird
zakird / gist:9992656
Created April 5, 2014 14:26
keybase.md
### Keybase proof
I hereby claim:
* I am zakird on github.
* I am zakir (https://keybase.io/zakir) on keybase.
* I have a public key whose fingerprint is 1237 0644 0259 3491 7A91 3F4B 763B 58DE C2F6 F0AA
To claim this, I am signing this object:
@zakird
zakird / gist:6710089
Last active December 23, 2015 23:29
IPv4 Address Bitmap
// bitmap of observed IP addresses
static uint64_t *ip_seen = NULL;
static const int IP_SEEN_SIZE = 0x4000000; // == 2^32/64
// check if we've received a response from this address previously
static inline int check_ip(uint32_t ip)
{
return (ip_seen[ip >> 6] >> (ip & 0x3F)) & 1;
}
@zakird
zakird / truthy.py
Last active December 17, 2015 14:29
Module that provides a simple Pythonic interface to the Truthy twitter API. To use, place it in the folder named "truthy.py" in the same directory as your code.
#!/usr/bin/env python
"""
Module that provides a simple Pythonic interface to the Truthy twitter API.
Documentation on how the API works is available at https://www.mashape.com/truthy/truthy-1. This
library provides a very simple interface that hands back data from each of the Truthy API endpoints
and manages pagination. Each class (TruthyMemes, TruthyNetworks, TruthyTimelines, TruthyUsers) has
a single method `get` which accepts all of the parameters defined by the Truthy API and returns
all results. API exceptions are all children of APIError. Note that because this library manages
pagination, none of the library calls accept the offset parameter defined by the API documentation.
#include "postgres.h"
#include "fmgr.h"
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/bio.h>
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
@zakird
zakird / m2_basic_connectssl.py
Created November 7, 2011 21:45
M2Crypto Connect SSL Example
import M2Crypto
address = "mail.google.com"
context = M2Crypto.SSL.Context();
context.set_allow_unknown_ca(True)
context.set_verify(M2Crypto.SSL.verify_none, True)
conn = M2Crypto.SSL.Connection(context)
conn.connect((address, 443))
@zakird
zakird / chrome_cookie_db.rb
Created November 6, 2011 03:03
Chrome Cookies Database