Skip to content

Instantly share code, notes, and snippets.

@sp3c73r2038
sp3c73r2038 / Kconfig
Created March 31, 2013 17:05
gentoo xen config
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.7.10-gentoo Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
@sp3c73r2038
sp3c73r2038 / indent.el
Created April 26, 2013 02:42
indent / unindent region of text in emacs, C/P from EmacsWiki
(defun shift-text (distance)
(if (use-region-p)
(let ((mark (mark)))
(save-excursion
(indent-rigidly (region-beginning)
(region-end)
distance)
(push-mark mark t t)
(setq deactivate-mark nil)))
(indent-rigidly (line-beginning-position)
@sp3c73r2038
sp3c73r2038 / b64.js
Last active September 23, 2020 06:13
pure javascript implemented base64 encoding/decoding library.
;
(
function () {
'use strict'
var root = this
var b64
if (typeof exports !== 'undefined') {
@sp3c73r2038
sp3c73r2038 / recv.py
Created May 5, 2013 02:24
rabbitmq basic consumer
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 - AleiPhoenix <[email protected]>
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 / rvm.markdown
Last active December 17, 2015 01:39
rvm basic usage

RVM

RVM是Ruby Version Manager的缩写,是管理Ruby版本的工具,方便在开发、部署的时候于多个Ruby环境中切换与使用

关于RVM的信息,请参考官方网站的最新资料为准

安装rvm

以bash为例

@sp3c73r2038
sp3c73r2038 / error.log
Created May 10, 2013 04:20
fluentd 0.10.33 msgpack 0.5.4 segfault
/home/evans/.rvm/gems/ruby-1.9.3-p392@fluentd-master/gems/fluentd-0.10.33/lib/fluent/event.rb:34: [BUG] Segmentation fault
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0057 p:---- s:0212 b:0212 l:000211 d:000211 CFUNC :to_msgpack
c:0056 p:0019 s:0208 b:0208 l:0021d0 d:000207 BLOCK /home/evans/.rvm/gems/ruby-1.9.3-p392@fluentd-master/gems/fluentd-0.10.33/lib/fluent/event.rb:34
c:0055 p:---- s:0204 b:0204 l:000203 d:000203 FINISH
c:0054 p:---- s:0202 b:0202 l:000201 d:000201 CFUNC :call
c:0053 p:0027 s:0197 b:0197 l:000188 d:000196 BLOCK /home/evans/.rvm/gems/ruby-1.9.3-p392@fluentd-master/gems/fluentd-0.10.33/lib/fluent/event.rb:107
c:0052 p:---- s:0194 b:0194 l:000193 d:000193 FINISH
@sp3c73r2038
sp3c73r2038 / Kconfig.md
Last active December 30, 2015 12:58
My Kernel config record...
@sp3c73r2038
sp3c73r2038 / ruby.markdown
Last active February 22, 2025 22:29
executable host ruby is required. use --with-baseruby option

When compiling ruby from source tarball by hand, if you got executable host ruby is required. use --with-baseruby option. Then this can be the reason.

make distclean (assume you configure'ed once) then configure and make, got

executable host ruby is required. use --with-baseruby option

distclean cleans out some file generated from erb, which requiring a existing ruby.

@sp3c73r2038
sp3c73r2038 / app.py
Last active May 24, 2021 11:51
how to acccess multiple database with same tablename, in Flask and SQLAlchemy.
# -*- coding: utf-8 -*-
from flask import Flask
from sqlalchemy import SQLAlchemy
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql+oursql://foo:bar@localhost/test1"
# binds multiple database definition
app.config['SQLALCHEMY_BINDS'] = {
"db1": "mysql+oursql://foo:bar@localhost/test1",
@sp3c73r2038
sp3c73r2038 / apple_bl.patch
Created July 4, 2013 15:26
patches to make macbookpro 8,2 (2011 early) work under (Gentoo) Linux
--- a/drivers/video/backlight/apple_bl.c
+++ b/drivers/video/backlight/apple_bl.c
@@ -31,6 +31,8 @@ struct hw_data {
/* I/O resource to allocate. */
unsigned long iostart;
unsigned long iolen;
+ unsigned long io_1_start;
+ unsigned long io_1_len;
/* Backlight operations structure. */
const struct backlight_ops backlight_ops;