Skip to content

Instantly share code, notes, and snippets.

View sandeepshetty's full-sized avatar

Sandeep Shetty sandeepshetty

View GitHub Profile
@barnabywalters
barnabywalters / FifoQueue.php
Last active December 30, 2015 17:49
Taproot post-storage code as of 2013-12-08. Working live on waterpigs.co.uk, probably a little too rusty/specific for convenient use elsewhere but maybe of interest. storage.php is basic functional library — currently it depends on symfony/yaml for post serialisation but that can be replaced with any function capable of serializing an array stru…
<?php
namespace Taproot;
use SplQueue;
class FifoQueue extends SplQueue {
protected $capacity;
public function __construct($capacity) { $this->capacity = $capacity; }
@sandeepshetty
sandeepshetty / YYYY-[1-6].json
Last active December 19, 2015 10:09
Converspace JSON store
{
"entries": [
{
"type": "post",
"id": "2013/07/06/4",
"content": "",
"published": "",
"updated": "",
"response_counts": {
"comments": 0,
@aaronpk
aaronpk / README.md
Last active February 16, 2021 18:02

Swap out the two URLs (first is source, second is target) then run with curl:

curl -X POST -d @pingback.xml http://example.com/xmlrpc
@nolanlawson
nolanlawson / fix_android_apk.py
Last active December 14, 2015 12:58
Fixes an Android APK built by PhoneGap Build to correct the problem of xhdpi images not being properly added (https://github.com/phonegap/build/issues/9). Requires apktool and jarsigner to already be installed.
#!/usr/bin/env python
# fix an Android APK built by PhoneGap Build to correct the problem of
# xhdpi images not being correctly added (https://github.com/phonegap/build/issues/9)
#
# REQUIRES apktool and jarsigner to already be installed and on the PATH.
#
# usage: fix_android_apk.py www/config.xml InputFile.apk OutputFile.apk
#
import os,sys,shutil,tempfile,xml.dom.minidom
<?php
function gfm($text){
# Extract pre blocks
$extractions = array();
$text = preg_replace_callback('/<pre>.*?<\/pre>/s', function($matches) use (&$extractions){
$match = $matches[0];
$md5 = md5($match);
$extractions[$md5] = $match;
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end