Skip to content

Instantly share code, notes, and snippets.

View jinleileiking's full-sized avatar
🐰
Gopher, Rubist, Phper, Now learning Rust, Linuxer, Vimer, Father of 2 girl

jinleileiking jinleileiking

🐰
Gopher, Rubist, Phper, Now learning Rust, Linuxer, Vimer, Father of 2 girl
View GitHub Profile
@jinleileiking
jinleileiking / install.sh
Last active August 29, 2015 13:57
Install gentoo64 in vbox using rescue cd
#############################################################
# IN VBOX #
# Use nat. #
#############################################################
passwd
#############################################################
# IN Putty #
# #
# telnet vbox in ssh, so you can copy #
@jinleileiking
jinleileiking / random.c
Created November 12, 2014 02:46
random.c
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
ssize_t get_random()
{
int randomData = open("/dev/random", O_RDONLY);
int myRandomInteger;
size_t randomDataLen = 0;
@jinleileiking
jinleileiking / tdes.rb
Created July 5, 2010 04:48
Ruby 3Des
require 'lib/ruby-des'
class TDES
class << self
def en_des plain, key
ret = ''
blocks = plain.scan(/.{16}/)
blocks.each do |block|
ret = ret + en_des_block(block, key)
end
class Subject < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
acts_as_tree
class << self
@@all_subjects =[]
def get_all_childrens_recursive parent
return if parent == nil
@jinleileiking
jinleileiking / gist:2717471
Created May 17, 2012 08:45
Linux Commands
交叉编译configure
CC=/eldk/usr/bin/ppc_8xx-gcc ./configure --host=ppc-linux --prefix=/home/jinlei/iconv_static_lib_ppc
linux和win共享文件夹
mkdir /mnt/leiking
mount -t smbfs -o username=Administrator,iocharset=GB2312 -l //10.86.10.48/Codes /mnt/leiking/
mkdir /mnt/leiking/6204
mount -t smbfs -o username=Administrator,iocharset=GB2312 -l //10.86.10.48/Code /mnt/leiking/6204
@jinleileiking
jinleileiking / sqlite.rb
Created May 17, 2012 08:44
Sqlite using ruby
require 'rubygems'
require 'sqlite3'
db = SQLite3::Database.new( "ec00" )
begin
puts "dropping tables....."
db.execute("drop table member;")
db.execute("drop table rule;")
puts "done...."
@jinleileiking
jinleileiking / crc.c
Created May 17, 2012 08:16
Testing f**king CRC
typedef unsigned short WORD16;
typedef unsigned long WORD32;
typedef unsigned char BYTE;
#define NULL 0
#define SWAP16(A) (((A)>>8) | (((A)&0x00ff) <<8))
/* CRC16表 */
const WORD16 crctab16[] ={
// X16+X12+X5+1 余式表
Device  Phase  Data                                                                                                    Description       Cmd.Phase.Ofs(rep)
------  -----  ------------------------------------------------------------------------------------------------------  ----------------  ------------------
  22    CDB    00 00 00 00  00 00                                                                                      TEST UNIT READY          1.1.0        
  20.1  DO     55 53 42 43  b8 dd 17 87  00 00 00 00  00 00 06 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00     USBC............         2.1.0        
  20.1  DI     55 53 42 53  b8 dd 17 87  00 00 00 00  00                                                               USBS.........            3.1.0        

55 53 42 43 b8 dd 17 87 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

app-admin/hddtemp
app-admin/sudo
app-admin/syslog-ng
app-arch/unrar
app-editors/gvim
app-emulation/virtualbox-guest-additions
app-i18n/fcitx
app-i18n/fcitx-cloudpinyin
app-i18n/fcitx-configtool
app-misc/colordiff
@jinleileiking
jinleileiking / dm370.md
Created July 3, 2012 06:18
dm370 将xloader,uboot,kernel,fs移到nand

flash x-loader & uboot to nandflash.

from TMS320DM3730_Software_Developers_Guide.pdf:

How to create an SD card
This section explained the procedure required for creating SD card image for DM3730 and the steps has been
verified on 2GB and 4GB SD cards.
1.  Plug an SD card on Linux host machine.
2.  Run dmesg command to check the device node. Triple check this to ensure you do not damage your HDD