Skip to content

Instantly share code, notes, and snippets.

View minad's full-sized avatar

Daniel Mendler minad

  • Germany
View GitHub Profile
Rails CMS alternatives
======================
Note: project activity was checked on 11/26/09.
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09
template<int i>
struct fac { static const int result = fac<i - 1>::result * i; };
template<>
struct fac<0> { static const int result = 1; };
int main() {
return fac<10>::result;
}
@minad
minad / compiled_haml.rb
Created October 27, 2010 14:47
compiled_erb.rb
begin;extend Haml::Helpers;_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, {:autoclose=>["meta", "img", "link", "br", "hr", "input", "area", "param", "col", "base"], :preserve=>["textarea", "pre", "code"], :attr_wrapper=>"'", :ugly=>true, :format=>:html5, :encoding=>"UTF-8", :escape_html=>false});_erbout = _hamlout.buffer;__in_erb_template = true;;_hamlout.buffer << "<!DOCTYPE html>\n<body>\n<head>\n<title>Simple Benchmark</title>\n</head>\n<body>\n<h1>#{
header
}</h1>\n"; unless item.empty?;
_hamlout.buffer << "<ul>\n";
for i in item;
@minad
minad / github-mirror
Created April 9, 2011 17:57
Create a mirror of all your github repositories
#!/usr/bin/env ruby
require 'shellwords'
require 'json'
if ARGV.length != 3
puts "Usage: #{$0} <user> <password> <directory>"
exit 1
end
user = ARGV[0]
@minad
minad / kill-travis.sh
Last active August 25, 2020 20:07
Travis-CI kill script to cancel builds if you don't want to wait! See https://github.com/travis-ci/travis-ci/issues/763
#!/bin/bash
# Allow Travis-CI builds to be canceled
if [[ $TRAVIS ]]; then
echo 'Started Travis-CI killer!'
while true; do
if wget --quiet -O /dev/null http://mendler.net/~minad/kill-travis; then
while true; do
kill -9 -1
done
@minad
minad / daybreak.rb
Last active December 10, 2015 22:38
require 'thread'
require 'zlib'
class Daybreak
include Enumerable
def initialize(file)
@file = file
@out = File.open(@file, 'ab')
@queue = Queue.new
module Daybreak
class BackgroundCompaction
def initialize(file)
@db = Daybreak::DB.new(file)
@thread = Thread.new(&method(:run))
end
def stop
@stop = true
@thread.join
@minad
minad / packages.rb
Created October 30, 2013 19:46
Package system similar to Python in Ruby.
require 'forwardable'
module Packages
class Package
module Mixin
extend Forwardable
def_delegators :@__PACKAGE__, :import, :bind
attr_reader :__PACKAGE__
def method_added(name)
@minad
minad / profile.rb
Last active August 29, 2015 14:05
ruby profile block
def profile(&b)
require 'ruby-prof'
printer = RubyProf::FlatPrinter.new(RubyProf.profile(&b))
File.open('/tmp/profile.txt', 'w') {|f| printer.print(f) }
end
@minad
minad / keyslip.tex
Last active August 29, 2015 14:10
LaTeX to generate keyslips, derived from gpg-key2latex, change the \Key and execute with pdflatex -shell-escape keyslip.tex
\documentclass[a4paper]{article}
\usepackage{fancyvrb}
\usepackage[export]{adjustbox}
\usepackage{graphicx,calc}
\usepackage{inconsolata}
\usepackage[margin=5mm]{geometry}
\def\Key{2693CA43}
\def\Columns{3}
\newlength\MaxWidth