Skip to content

Instantly share code, notes, and snippets.

@sp3c73r2038
sp3c73r2038 / path.py
Created December 17, 2012 07:16
check path-related functions in os.path
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# put this script in the path like
# assumed /tmp (cwd)
# /tmp/dir1/dir2/path.py
# /tmp/dir3 symlinked to /tmp/dir1/dir2
#
# and run with
# python ../tmp/hello3/path.py
@sp3c73r2038
sp3c73r2038 / brew.log
Created January 14, 2013 06:11
gnu-smalltalk 3.2.4 failed to build on 10.8.2
HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install gnu-smalltalk
==> Downloading http://ftpmirror.gnu.org/smalltalk/smalltalk-3.2.4.tar.xz
Already downloaded: /Library/Caches/Homebrew/gnu-smalltalk-3.2.4.tar.xz
xz -dc "/Library/Caches/Homebrew/gnu-smalltalk-3.2.4.tar.xz" | /usr/bin/tar xf -
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file Makefile.am
patching file configure.ac
==> autoreconf -ivf
autoreconf -ivf
@sp3c73r2038
sp3c73r2038 / archlinux.install.20130115.markdown
Last active July 13, 2021 02:47
how to install archlinux on a BIOS i386 (64 bit supported) virtualbox machine.

archlinux install

latest info and more instructions, please refer to the original archlinux wiki page!

  • get archboot and insert it into cdrom
  • network config (generally done)
  • prepare the storage (using cfdisk, a boot and root partition)
  • mount partitions
@sp3c73r2038
sp3c73r2038 / ABNF-syntax.rb
Created February 19, 2013 09:03
Augmented BNF for Syntax Specifications example in ruby.
#!/usr/bin/env ruby
# -*- coding:utf-8 -*-
# some syntax define in RFC
# refer to http://tools.ietf.org/html/rfc5234
def loop_print(range)
if range.is_a? Range
range.each do |v|
@sp3c73r2038
sp3c73r2038 / recv.py
Created February 20, 2013 03:50
rabbitmq message receiver example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 - AleiPhoenix <aleiphoenix@gmail.com>
import amqplib.client_0_8 as amqp
# This is the function that basic_consume will send messages to
def process_message( message ):
""" Callback function used by channel.basic_consume """
print 'Received: %s' % message.body
@sp3c73r2038
sp3c73r2038 / emerge.log
Created February 26, 2013 23:45
Gentoo prefix on Mac OS X 10.8 / eix 0.28.2 compile error
/Users/aleiphoenix/Gentoo/usr/lib/gcc/x86_64-apple-darwin12/4.2.1/include/g++-v4/bits/stl_map.h: In member function '_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Tp = OutputString, _Compare = std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, _Alloc = std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, OutputString> >]':
output/formatstring.cc:385: instantiated from here
/Users/aleiphoenix/Gentoo/usr/lib/gcc/x86_64-apple-darwin12/4.2.1/include/g++-v4/bits/stl_map.h:350: error: no matching function for call to 'OutputString::OutputString(OutputString)'
make[2]: *** [output/formatstring.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/Users/aleiphoenix/Gentoo/usr/lib/gcc/x86_64-apple-darwin12/4.2.1/include/g++-v4/bits/stl_map.h: In member function '_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Ke
@sp3c73r2038
sp3c73r2038 / RPi.kconfig.markdown
Created February 27, 2013 06:53
kernel config for 3.6.11 of RPi

RPI 3.6.11 kernel for home router

Networking support --->
  Networking options --->
    [*] Network packet filtering framework (Netfilter) --->
      Core Netfilter Configuration --->
        <*> Netfilter connection tracking support
        <*>   FTP protocal support
@sp3c73r2038
sp3c73r2038 / net-post.rb
Created March 5, 2013 10:02
http post request with 'net/http' in ruby
uri = URI('http://example.com')
req = Net::HTTP::Post.new(uri)
req.set_form_data('argu1' => 'value1',
'argu2' => 'value2')
body = ''
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
res = http.request(req)
end
return res.body
@sp3c73r2038
sp3c73r2038 / gitolite.rc
Last active December 14, 2015 22:29
gitolite g2 config for gitcorp
# configuration variables for gitolite
# PLEASE READ THE DOCUMENTATION BEFORE EDITING OR ASKING QUESTIONS
# ( http://github.com/sitaramc/gitolite/blob/pu/doc/gitolite.rc.mkd )
# ( or http://sitaramc.github.com/gitolite/doc/gitolite.rc.html )
# this file is in perl syntax. However, you do NOT need to know perl to edit
# it; it should be fairly self-explanatory and easy to maintain
# ------------------------------------------------------------------------------
@sp3c73r2038
sp3c73r2038 / ssh.markdown
Created March 27, 2013 06:26
a brief introduction to ssh

A brief introduction to SSH (Version 0.1)

为什么会有这篇介绍?

不少人对ssh有疑问或者不明白,典型的例子是在gitcorp/github上添加了公钥后发现无法clone或者push仓库里的代码。

前言

ssh是个很大的话题,会发现牵涉到unix-like下很多东西,这里只谈谈我们日常工作中接触最多的那部分