Skip to content

Instantly share code, notes, and snippets.

View phaer's full-sized avatar
💭

Paul Haerle phaer

💭
View GitHub Profile
@radamant
radamant / haml_converter.rb
Created July 19, 2010 14:16
Simple haml-sass conversion for jekyll
module Jekyll
require 'haml'
class HamlConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /haml/i
end
@dtjm
dtjm / haml_converter.rb
Created August 17, 2010 06:07 — forked from radamant/haml_converter.rb
Haml and Sass plugin for Jekyll 0.6.2
module Jekyll
require 'haml'
class HamlConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /haml/i
end
@andyfowler
andyfowler / lessjs.rb
Created October 23, 2010 21:46
Jekyll plugin to render less.js - fixed for new versions of jekyll
module Jekyll
class LessCssFile < StaticFile
def write(dest)
# do nothing
end
end
# Expects a lessc: key in your _config.yml file with the path to a local less.js/bin/lessc
# Less.js will require node.js to be installed
@miikka
miikka / Sass.hs
Created February 20, 2011 14:11
Hakyll + Sass
module Sass (sass) where
import Control.Monad.IO.Class (liftIO)
import Text.Hakyll.File (makeDirectories, toDestination)
import Text.Hakyll.HakyllAction (HakyllAction(..), runHakyllActionIfNeeded)
import Text.Hakyll.HakyllMonad (Hakyll)
import System.FilePath (replaceExtension)
import System.Process (readProcess)
@phaer
phaer / ostatus_tag.rb
Created April 10, 2011 16:06
Simple Jekyll tag which displays the notices in a given status.net/ostatus feed.
require 'date'
require 'ostatus'
module Jekyll
class RenderOStatus < Liquid::Tag
def render(context)
site = context.registers[:site]
feed = OStatus::Feed.from_url(site.config['ostatus_feed'])
result = "<h2>#{feed.author.name}'s microblog</h2>"
@Gozala
Gozala / example.js
Created January 29, 2012 03:46
Workaround for lack of "tail call optimization" in JS
// Lack of tail call optimization in JS
var sum = function(x, y) {
return y > 0 ? sum(x + 1, y - 1) :
y < 0 ? sum(x - 1, y + 1) :
x
}
sum(20, 100000) // => RangeError: Maximum call stack size exceeded
// Using workaround
@teh
teh / avahi_publish.py
Created June 8, 2012 08:41
avahi publish
#! /usr/bin/env python
# avahi-alias.py
import avahi, dbus
from encodings.idna import ToASCII
import logging
# Got these from /usr/include/avahi-common/defs.h
CLASS_IN = 0x01
TYPE_CNAME = 0x05
(*
ocamlbuild \
-pkg containers \
-pkg lwt \
-pkg yojson \
-pkg conduit.lwt-unix \
-pkg nocrypto \
-pkg nocrypto.unix \
-pkg websocket.lwt \
-cflags "-w A-4-40-41-42-44" \
@ageis
ageis / systemd_service_hardening.md
Last active November 15, 2024 09:28
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@edolstra
edolstra / nix-lang.md
Last active October 30, 2024 00:36
Nix language changes

This document contains some ideas for additions to the Nix language.

Motivation

The Nix package manager, Nixpkgs and NixOS currently have several problems:

  • Poor discoverability of package options. Package functions have function arguments like enableFoo, but there is no way for the Nix UI to discover them, let alone to provide programmatic ways to