Skip to content

Instantly share code, notes, and snippets.

@saidie
saidie / articlefilter.js
Created April 22, 2012 02:41
article filter
function nextArticle(articles){
if(articles.length == 0) return(null);
var date = new Date();
return(articles[date.getMinutes() % articles.length]);
}
@saidie
saidie / wpa2-peap-mschapv2
Last active December 18, 2015 13:59
wicd template for WPA2 PEAP (EAP-MSCHAPv2). Modified version of /etc/wicd/encryption/templates/wpa2-peap in an Arch package wicd 1.7.2.4-7.
name = WPA2-PEAP-MSCHARPv2
author = saidie
version = 1
require identity *Username password *Password
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="$_ESSID"
proto=RSN
@saidie
saidie / .bashrc
Last active December 20, 2015 22:49
Show a git branch in bash prompt.
GIT_BRANCH='`git branch 2> /dev/null | sed -e "/^[^*]/d" -e "s/^* \(.*\)$/(\1)/"`'
PS1="[\u@\h \W$GIT_BRANCH]\$ "
@saidie
saidie / GtkIconList.hs
Created August 24, 2013 08:33
Haskell code which shows GTK default theme icons.
module Main
( main
) where
import Control.Monad (filterM)
import Data.Maybe (fromJust)
import Graphics.UI.Gtk
import qualified Graphics.UI.Gtk.ModelView
@saidie
saidie / fluentd.service
Created October 5, 2014 12:32
Fluentd service file for systemd
[Unit]
Description=Fluentd
Documentation=http://www.fluentd.org/
After=network.target
[Service]
Type=forking
ExecStart=/usr/bin/fluentd -d /run/fluentd.pid
PIDFile=/run/fluentd.pid
Restart=on-failure
@saidie
saidie / Gemfile
Last active August 16, 2016 00:14
Convert Pocket export file for org-mode
source "https://rubygems.org"
gem "nokogiri"
gem "open_uri_redirections"
@saidie
saidie / ghpr.el
Last active December 24, 2015 13:56
Command to create GitHub pull-request by hub command
(defun create-github-pull-request ()
(interactive)
(let ((buffer (get-buffer-create "*hub pull-request*"))
(cwd default-directory)
(my-local-map (make-keymap)))
(define-key my-local-map (kbd "C-c C-k")
'(lambda ()
(interactive)
(kill-buffer (current-buffer))))
lsips () {
aws ec2 describe-instances $@ --query "Reservations[].Instances[].PrivateIpAddress"
}
lsfilters () {
lsips --filters $@
}
lstag () {
lsfilters "Name=tag-key,Values=$1" "Name=tag-value,Values=$2"
#!/bin/sh
adb push hosts /data/local/tmp
adb shell "su -c 'mount -orw,remount /system'"
adb shell "su -c 'cp /data/local/tmp/hosts /system/etc/hosts'"
adb shell "su -c 'mount -oro,remount /system'"