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
| // Originally found at: http://www.sanmayce.com/Railgun/index.html | |
| // --------------------------------------------------------------- | |
| // All Railgun variants are written by Georgi 'Kaze', they are free, however I expect the user to mention its homepage, that is: http://www.sanmayce.com/Railgun/index.html | |
| // Author's email: [email protected] | |
| // Caution: For better speed the case 'if (cbPattern==1)' was removed, so Pattern must be longer than 1 char. | |
| char * Railgun_Doublet (char * pbTarget, char * pbPattern, uint32_t cbTarget, uint32_t cbPattern) | |
| { | |
| char * pbTargetMax = pbTarget + cbTarget; | |
| register uint32_t ulHashPattern; | |
| uint32_t ulHashTarget, count, countSTATIC; |
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
| # NB: Don't forget to install p4merge from | |
| # http://filehost.perforce.com/perforce/r13.4/bin.macosx106x86/P4V.dmg | |
| # and follow the configuration instructions at http://www.andymcintosh.com/?p=33 | |
| # Some interesting .git_config files here: | |
| # http://stackoverflow.com/questions/267761/what-does-your-gitconfig-contain | |
| [user] | |
| name = YOUR NAME HERE | |
| email = YOUR EMAIL HERE |
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
| #!/usr/bin/env perl | |
| ## | |
| # @author Jay Taylor [@jtaylor] | |
| # | |
| # @date 2014-02-04 | |
| # | |
| # @description Converts an IPv4 address into an IP number, the unsigned 32-bit numeric representation of an IPv4 address. | |
| # |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """Alexa top 1-million websites daily snapshot historical archival system.""" | |
| __author__ = 'Jay Taylor [@jtaylor]' | |
| import datetime, hashlib, logging, os, urllib2 | |
| logging.basicConfig(format='%(asctime)s [%(levelname)s] %(message)s', level=logging.INFO) |
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
| # -*- coding: utf-8 -*- | |
| """ | |
| Soft-deletion for django resources. | |
| Originally found at: http://datahackermd.com/2013/django-soft-deletion/ | |
| """ | |
| import logging |
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
| ip_column_name = 'ip' | |
| keyword = '63.0.0.0/24' | |
| where = '{}::inet << %s::inet::cidr'.format(ip_column_name) | |
| match = MyDjangoModel.objects.all() | |
| match = match.extra(where=[where], params=[keyword]) |
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
| class AutoFkShifterMixIn(object): | |
| def __init__(self, *args, **kw): | |
| """Automatically translate any foreign keys to the the *_id field if an id rather than an object has been provided. Also removes m2m kwargs (they'll cause Django ORM to error out).""" | |
| for m2m_field in filter(lambda f: f.name in kw, self._meta.many_to_many): | |
| del kw[m2m_field.name] | |
| for fk_field in filter(lambda f: isinstance(f, models.ForeignKey), self._meta.fields): | |
| if fk_field.name in kw and isinstance(kw[fk_field.name], (int, long, str)): | |
| kw['{}_id'.format(fk_field.name)] = kw.pop(fk_field.name) | |
| super(AutoFkShifterMixIn, self).__init__(*args, **kw) |
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
| #!/usr/bin/env bash | |
| set -e | |
| ## | |
| # @author Jay Taylor [@jtaylor] | |
| # | |
| # @date 2014-06-28 | |
| # | |
| # @description Git repository statistics: Get # of commits and lines changed since some previous point in time. | |
| # |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """Use Asana's "export project to JSON" function and copy-paste contents to an "X.json" file.""" | |
| import codecs | |
| import csv | |
| import json | |
| import pprint | |
| import re |
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
| #!/usr/bin/env bash | |
| username='YOUR_HN_USERNAME' | |
| cookie='user=HN_AUTH_COOKIE' | |
| next="saved?id=${username}" | |
| while ! [[ -z "${next}" ]]; do | |
| echo "next=${next}" | |
| next=$(curl "https://news.ycombinator.com/${next}" \ |