This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
typedef unsigned int u32; | |
typedef unsigned long long u64; | |
//------------------------------------------------------------------------- | |
// WorkArea | |
//------------------------------------------------------------------------- |
This file contains 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 | |
# Useful common polynomials: | |
#POLY = 0x82F63B78 # CRC-32C (Castagnoli) | |
#POLY = 0xEB31D82E # CRC-32K (Koopman) | |
#POLY = 0xD5828281 # CRC-32Q | |
class CRCForger(): | |
def __init__(self, *args, **kwargs): |
This file contains 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
/** | |
* A memoizer (Y-combinator), with a cache on operator(). | |
* | |
* The type of the function that can be memoized is (((Args...)->R), Args...) -> R, which | |
* makes the memoizer of type ( (((Args...) -> R), Args...) -> R ) -> ((Args...) -> R). | |
* | |
* WARNING: If the memoized function modifies its arguments, the results will not be | |
* cached correctly. | |
*/ |
This file contains 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
import struct | |
class bitbuffer: | |
# TODO: need reader? | |
def __init__(self): | |
self.buffer = b'' | |
self.byte = 0 | |
self.bit_pos = 7 | |
def append(self, value, nbits): |
This file contains 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
/* This is how a PhD holder thinks UCS-2 is converted to UTF-8 */ | |
size_t gsm_convert_ucs2(const uint8_t *buf, size_t length, unsigned char *dest) | |
{ | |
size_t i; | |
size_t j; | |
for (i=0,j=0;i<length;i+=2) { | |
if (buf[i] == 0) | |
dest[j++] = buf[i+1]; | |
else { | |
snprintf((char *)&dest[j], 256-j, "\\%02x%02x", buf[i], buf[i+1]); |
This file contains 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
/* | |
* Partial applied functions in C | |
* Leandro Pereira <leandro@tia.mat.br> | |
*/ | |
#include <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <stdbool.h> |
This file contains 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
// ==UserScript== | |
// @name nuke noscript | |
// @namespace https://gist.github.com/mfukar/d1dd369deaa7c3941fde | |
// @version 0.2 | |
// @description Remove all <noscript> tags in every document | |
// @author mfukar | |
// @grant none | |
// ==/UserScript== | |
/* jshint -W097 */ | |
'use strict'; |
This file contains 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 | |
# @file dotd.py | |
# @author Michael Foukarakis | |
# @version 0.6 | |
# @date Created: Sun Aug 25, 2013 09:57 BST | |
# Last Update: Fri Dec 30, 2016 10:21 EET | |
#------------------------------------------------------------------------ | |
# Description: Log analyser for Dawn of the Dragons raids. | |
#------------------------------------------------------------------------ | |
# History: None yet |
This file contains 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
import sys | |
def main(): | |
N = raw_input() | |
elements = [int(element) for element in sys.stdin.read().split(' ')] | |
L, R = 0, len(elements) | |
# We got ourselves a maximum subarray problem, with inverted semantics. | |
# The subarray we want to find is the one to flip all the bits in. |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.local.jekyll.server.agent</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>PATH_TO_YOUR_BUNDLE_BINARY_OR_WRAPPER</string> |