Skip to content

Instantly share code, notes, and snippets.

@calmez
calmez / text-filter.py
Last active August 29, 2015 14:26
Little tool to filter tex(t) files
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
class Cleaner:
def __init__(self, filename, *filter_actions):
self.file = open(filename, 'r')
self.filter_actions = filter_actions
@calmez
calmez / vid2gif
Created February 2, 2015 10:30
Making GIFs out of video files
#! /bin/sh
ffmpeg -i $1 -pix_fmt rgb24 output.gif
echo "Optimizing GIF"
convert -layers Optimize output.gif $2
rm -f output.gif
@calmez
calmez / string_search_benchmark.rb
Created September 9, 2014 14:21
ruby string matching overhead benchmark
require 'benchmark'
n = 100_000
with_iframe = open('with_iframe.html').read
without_iframe = open('without_iframe.html').read
Benchmark.bm do |x|
x.report("with_iframe, include?") do
n.times { with_iframe.include? "<iframe" }
@calmez
calmez / README
Created April 24, 2014 12:36
SpyVM Vagant setup
Have a symbolic link or the actual repositories as siblings:
- lang-smalltalk
- pypy
- rsdl
In VM repos are in /repos
Python path is already set up for rsdl usage.
@calmez
calmez / clang-warnings.h
Last active August 29, 2015 13:57
clang warnings
/*******************************************************************************
* Copyright (c) 2011, Jean-David Gadina - www.xs-labs.com
* Distributed under the Boost Software License, Version 1.0.
*
* Boost Software License - Version 1.0 - August 17th, 2003
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
@calmez
calmez / awesome-config.lua
Created November 14, 2012 23:01
awesome window manager config
-- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- Load Debian menu entries
@calmez
calmez / ml-avail.sh
Created November 11, 2012 20:11
small script that tells you when mountain lion is available
#!/bin/sh
URL='http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewMultiRoom?fcId=489264329&mt=12'
SEARCH_STRING="mountain"
echo "Mountain Lion"
echo "Press Ctrl-C to exit."
echo ""
while true ; do
curl -silent -A "iMacAppStore/1.0.1 (Macintosh; U; Intel Mac OS X 10.6.7; en) AppleWebKit/533.20.25" ${URL} | grep -i "${SEARCH_STRING}" > /dev/null
if [ "$?" == "0" ]; then
echo "Search string found!"
@calmez
calmez / lk command install
Created November 10, 2012 16:34
useful things for lively
prerequisites
=============
git clone git://github.com/LivelyKernel/livelykernel-scripts.git
(in dir <lk-scripts-repo-dir>)
dependencies of a node.js app
=============================
npm list --parseable | sed "s/.*\/node_modules\/\(.*\)$/\1/" | sed "s/\/.*$//" | sort | uniq
@calmez
calmez / person.py
Created August 27, 2012 20:58
Programming Python (Mark Lutz / 4th Edition / O'Reilly) – Examples
#!/usr/local/bin/python3
"""
Implementation of persons for a pim database
"""
import shelve
import tkinter
import tkinter.messagebox