Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block aleiphoenix

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
aleiphoenix /
Created Feb 6, 2015
a toolkit Python script looking into /proc/net/tcp
# -*- coding: utf-8 -*-
import re
import sys
with open('/proc/net/tcp') as f:
lineno = 0
sockets = []
for line in f:
lineno += 1
if lineno == 1:
aleiphoenix /
Created Feb 2, 2015
Java ThreadLocal demo
package net.momoka;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* Hello world!
aleiphoenix / subprocess.php
Last active Aug 29, 2015
a toolkit function for PHP
View subprocess.php
// I know, I know, there are proc_open, exec, system functions to use.
// But they just suck...
// So I wrote this, hope this will help ourselves out :3
function subprocess($cmd, $login = FALSE, $cwd = './',
$shell = '/bin/bash', $pipespec = NULL) {
$pid = getmypid();
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;
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
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 /
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 / 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 /
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 / 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
You can’t perform that action at this time.