Skip to content

Instantly share code, notes, and snippets.

View tigefa4u's full-sized avatar
📉
🚀 😧 ☕ 🚬

Sugeng Tigefa tigefa4u

📉
🚀 😧 ☕ 🚬
View GitHub Profile
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
desc 'Generate tags page'
task :tags do
puts "Generating tags..."
require 'rubygems'
require 'jekyll'
include Jekyll::Filters
options = Jekyll.configuration({})
site = Jekyll::Site.new(options)
site.read_posts('')
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@Sija
Sija / svn-index.xsl
Created January 19, 2011 09:11
XSLT file for SVN web indexes
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="*"/>
<xsl:template match="svn">
<html>
@rkhmelyuk
rkhmelyuk / gist:942492
Created April 26, 2011 15:31
lftp to upload a file to FTP
lftp -u $FTP_USERNAME,$FTP_PASSWORD $FTP_SERVER/$FTP_DIRECTORY -e 'put -a filename;quit'
@madhur
madhur / 0001-albino-windows-refactor.patch
Created September 1, 2011 07:34 — forked from jonforums/0001-albino-windows-refactor.patch
Make Jekyll play nice with Windows again post Albino + posix-spawn refactor
diff --git a/lib/albino.rb b/lib/albino.rb
index 387c8e9..b77d55e 100644
--- a/lib/albino.rb
+++ b/lib/albino.rb
@@ -1,4 +1,5 @@
require 'posix-spawn'
+require 'rbconfig'
##
# Wrapper for the Pygments command line tool, pygmentize.
@tmtk75
tmtk75 / markdown-tag.rb
Created November 30, 2011 08:10
Jekyll Markdown Tag
=begin
Jekyll tag to include Markdown text from _includes directory preprocessing with Liquid.
Usage:
{% markdown <filename> %}
Dependency:
- kramdown
=end
module Jekyll
class MarkdownTag < Liquid::Tag
def initialize(tag_name, text, tokens)
@mildred
mildred / transform_layouts.rb
Created December 13, 2011 15:55
Jekyll plugin to have layouts transformed by Converters as well, taken from https://github.com/mojombo/jekyll/pull/351
module Jekyll
class Layout
alias old_initialize initialize
def initialize(*args)
old_initialize(*args)
self.transform
end
@joelverhagen
joelverhagen / README.md
Created February 12, 2012 02:14
Jekyll YouTube Embed Plugin

This is a plugin meant for Jekyll.

Example use:

Easily embed a YouTube video. Just drop this file in your _plugins directory.

{% youtube oHg5SJYRHA0 %}
@vstoykov
vstoykov / maxmind_update.sh
Created March 2, 2012 09:56
Download MaxMind free database and place it in default location for pygeoip
#!/bin/bash
if [ `whoami` != 'root' ]; then
echo "You must to be root"
exit
fi
DOWNLOAD_URL="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz"
TEMPFILE="/tmp/GeoIPCity.dat"
TEMPFILEGZ="$TEMPFILE.gz"
GEOIP_DIR="/usr/local/share/GeoIP"