Skip to content

Instantly share code, notes, and snippets.

@debanjan-basu
debanjan-basu / Makefile
Created March 29, 2016 12:24
JSON to BSON conversion in C
all: json2bson
clean:
rm -f json2bson
json2bson: json2bson.c
${CC} $(shell pkg-config --cflags json libmongo-client glib-2.0) -Wall -O0 -ggdb3 -std=c99 ${CFLAGS} \
$(shell pkg-config --libs json libmongo-client glib-2.0) -o $@ $^
check: all
./json2bson <test.json >test.bson
@snakeye
snakeye / exif_gps.py
Last active July 11, 2024 19:54
Python: get GPS latitude and longitude coordinates from JPEG EXIF using exifread
import exifread
# based on https://gist.github.com/erans/983821
def _get_if_exist(data, key):
if key in data:
return data[key]
return None
@alcol80
alcol80 / btrfs-nixos-install.sh
Last active October 22, 2023 12:25
nixos install (boot + btrfs root + btrfs docker)
gdisk /dev/sda # make 1 partition
mkfs.vfat -n BOOT /dev/sda1
mkfs.btrfs -L root /dev/sdb
mkfs.btrfs -L docker /dev/sdc
mount -t btrfs -o noatime,discard,ssd,autodefrag,compress=lzo,space_cache /dev/sdb /mnt/
btrfs subvolume create /mnt/nixos
umount /mnt/
mount -t btrfs -o noatime,discard,ssd,autodefrag,compress=lzo,space_cache,subvol=nixos /dev/sdb /mnt/
@bascht
bascht / pinget.rb
Last active September 24, 2024 14:42
Download all a RSS feed and wget all the links for your personal offline reading pleasure. :)
#!/usr/bin/env ruby
# - encoding: utf-8 -
#
# E.g. with: pinget.rb https://feeds.pinboard.in/rss/secret:YOURSECRET/u:YOURUSERNAME/toread/
require 'rss'
require 'open-uri'
require 'uri'
WGET = ['wget',
@lmullen
lmullen / Makefile
Last active May 30, 2024 09:34
PDF slides and handouts using Pandoc and Beamer
SLIDES := $(patsubst %.md,%.md.slides.pdf,$(wildcard *.md))
HANDOUTS := $(patsubst %.md,%.md.handout.pdf,$(wildcard *.md))
all : $(SLIDES) $(HANDOUTS)
%.md.slides.pdf : %.md
pandoc $^ -t beamer --slide-level 2 -o $@
%.md.handout.pdf : %.md
pandoc $^ -t beamer --slide-level 2 -V handout -o $@
@aaronwolen
aaronwolen / slides.md
Last active November 11, 2022 23:57
Pandoc template to generate reveal.js slideshows.

% Title % Name % Date

My first slide

List

@mklabs
mklabs / bootstrap-plugins.txt
Created December 2, 2011 11:23
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js
@JeniT
JeniT / outside-agitator.html
Created August 2, 2011 20:24
microdata version of http://bruce.darcus.name/publications/articles/outside-agitator and resulting conversions using suggested microdata+RDF rules
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Dissent, Public Space and the Politics of Citizenship: Riots and the Outside Agitator</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<link
rel="stylesheet"
NEW
``disambiguate-add-year-suffix`` [Step (4)]
If set to "true" ("false" is the default), an alphabetic year-suffix is
added to ambiguous cites (e.g. "Doe 2007, Doe 2007" becomes "Doe 2007a, Doe
2007b") and to their corresponding bibliographic entries. The assignment of
the year-suffixes follows the order of the bibliographies entries, and
additional letters are used once "z" is reached ("z", "aa", "ab", ..., "az",
"ba", etc.). By default the year-suffix is appended to the cite, and to the
first year rendered through ``cs:date`` in the bibliographic entry, but its
@bergie
bergie / README.md
Created May 18, 2011 11:33
Falsy Values tutorials