Skip to content

Instantly share code, notes, and snippets.

aleiphoenix /
Created Feb 10, 2014
forking worker process server, handling signals with a queue. idea stolen from unicorn.
#!/usr/bin/env python
from datetime import datetime
import errno
from fcntl import fcntl, F_SETFL
import logging
import os
from select import select
from signal import signal, SIGQUIT, SIGINT, SIGTERM, SIGUSR1, SIGUSR2, SIGHUP
from signal import SIGCHLD, SIG_DFL, SIGKILL
import sys
aleiphoenix / test.rb
Created Apr 5, 2014
sequel example usage
View test.rb
# -*- encoding: binary -*-
require 'sequel'
require 'sqlite3'
Bundler.require(:default, :development)
DB = Sequel.connect("sqlite:///tmp/test.db")
# DB.create_table(:users) do
aleiphoenix / multilingualism.rb
Last active Aug 29, 2015
multilingualism support for jekyll
View multilingualism.rb
# example
# .
# |--
# |-- _config.yml
# |-- css
# | `-- main.css
# |-- feed.xml
# |-- .gitignore
# |-- _includes
# | |-- footer.html
aleiphoenix / refind.conf
Last active Aug 29, 2015
refind.conf for multi-boot on Macbook Pro
View refind.conf
# /EFI/refind/refind.conf
# gives you chance to change choice, manually
timeout 5
# tools for debuging, reboot without pushing damn button
showtools shell,reboot,exit
# scan internal disks, extenal(USB?) disks,
# optical drivers, and specify by following
aleiphoenix /
Created May 23, 2014
responsible GUI with multiprocessing.
# -*- coding: utf-8 -*-
from datetime import datetime
from multiprocessing import Process
from time import sleep
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
aleiphoenix / gitlab7.0_show_all_groups.patch
Created Jul 11, 2014
patch that addes a /groups page to show all groups, for GitLab 7.0.0
View gitlab7.0_show_all_groups.patch
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index a2629c5..020220e 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -4,7 +4,7 @@ class GroupsController < ApplicationController
before_filter :group, except: [:new, :create]
# Authorize
- before_filter :authorize_read_group!, except: [:new, :create]
+ before_filter :authorize_read_group!, except: [:new, :create, :index]
aleiphoenix /
Last active Aug 29, 2015
logging with syslog
# -*- coding: utf-8 -*-
# using logging module
# see
import logging
from logging.handlers import SysLogHandler
from logging import StreamHandler, Formatter
aleiphoenix /
Last active Aug 29, 2015
a simple python script dump ical basic info to stdout.
# -*- coding: utf-8 -*-
import sys
## It seems that locale will always be C(ascii) when
## mutt call this script via mailcap
from icalendar import Calendar
import pytz
aleiphoenix / mozconfig
Created Nov 11, 2014
mozilla build config for Hardened Gentoo x86_64
View mozconfig
export LDFLAGS="-Wl,-z,relro,-z,now"
mk_add_options PYTHON=/usr/bin/python2
mk_add_options AUTOCONF=autoconf-2.13
mk_add_options MOZ_MAKE_FLAGS="-j8"
ac_add_options --host=x86_64-pc-linux-gnu
ac_add_options --target=x86_64-pc-linux-gnu
aleiphoenix /
Last active Aug 29, 2015
jackson-databind ObjectMapper demo
package net.momoka;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
You can’t perform that action at this time.