Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
Focus

Changsheng Congee

🤔
Focus
View GitHub Profile
@Congee
Congee / libcpuid.rb
Created May 28, 2016
Homebrew formula for libcpuid
View libcpuid.rb
class Libcpuid < Formula
desc "A small C library for x86 CPU detection and feature extraction "
homepage "https://github.com/anrieff/libcpuid"
head "https://github.com/anrieff/libcpuid.git"
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "autoconf" => :build
def install
@Congee
Congee / precmd.zsh
Created May 26, 2016
shortening pwd
View precmd.zsh
autoload -U colors && colors
precmd() {
red_at="%{$fg[red]}@%{$reset_color%}"
red_dollar="%{$fg[red]%}$%{$reset_color%}"
typeset host_info
[[ -n $SSH_CONNECTION ]] && host_info="$USER${red_at}$HOST "
if [[ $USER == "CC" ]]; then
# number of chracters of the path of the prompt is less 30
# use '~' to represent $HOME as long as possible
@Congee
Congee / gdb.rb
Created Jan 13, 2016
For gdb to execute python3 script on OSX 10.10 or later
View gdb.rb
class UniversalBrewedPython < Requirement
satisfy { archs_for_command("python").universal? }
def message; <<-EOS.undent
A build of GDB using a brewed Python was requested, but Python is not
a universal build.
GDB requires Python to be built as a universal binary or it will fail
if attempting to debug a 32-bit binary on a 64-bit host.
EOS
@Congee
Congee / latexmk.rb
Last active Aug 29, 2015
latexmk on Mac OS X
View latexmk.rb
class Latexmk < Formula
desc "La­texmk com­pletely au­to­mates the pro­cess of gen­er­at­ing a LaTeX doc­u­ment."
homepage "http://users.phys.psu.edu/~collins/software/latexmk-jcc/"
url "http://users.phys.psu.edu/%7Ecollins/software/latexmk-jcc/latexmk-443a.zip"
sha256 "e410d295c0a47327b953ece5b582c294359bdf89138ef990d5621b020ff2bbe5"
depends_on :tex
depends_on "ghostscript" => :optional
def install
@Congee
Congee / zlog.rb
Created Mar 31, 2015
zlog in Homebrew
View zlog.rb
class Zlog < Formula
homepage "https://hardysimpson.github.io/zlog/"
stable do
url "https://github.com/HardySimpson/zlog/archive/1.2.12.tar.gz"
sha1 "592be9688df1a713e190e2a9664157516cc6724f"
end
head do
url "https://github.com/HardySimpson/zlog.git"
@Congee
Congee / r2.rb
Created Mar 30, 2015
radare2 homebrew
View r2.rb
require "formula"
class R2 < Formula
homepage "http://radare.org"
revision 2
head do
url "https://github.com/radare/radare2.git"
resource "bindings" do
View debian-patches-05_fix_off_by_one.diff
diff -urNad nbtscan-1.5.1~/nbtscan.c nbtscan-1.5.1/nbtscan.c
--- nbtscan-1.5.1~/nbtscan.c 2003-06-06 14:14:00.000000000 +0200
+++ nbtscan-1.5.1/nbtscan.c 2008-05-09 14:38:59.000000000 +0200
@@ -111,7 +111,7 @@
for(i=0; i< hostinfo->header->number_of_names; i++) {
service = hostinfo->names[i].ascii_name[15];
strncpy(name, hostinfo->names[i].ascii_name, 15);
- name[16]=0;
+ name[15]=0;
printf("%-17s Service: 0x%02x Flags: 0x%04x\n", name, service, hostinfo->names[i].rr_flags);
View debian-patches-04_fix_compiler_warnings.diff
diff -urNad nbtscan-1.5.1~/list.c nbtscan-1.5.1/list.c
--- nbtscan-1.5.1~/list.c 2008-05-08 14:10:54.000000000 +0200
+++ nbtscan-1.5.1/list.c 2008-05-08 14:12:29.000000000 +0200
@@ -49,7 +49,7 @@
if(item1==NULL) return 1;
if(item1->content == item2->content) return 0;
if(item1->content > item2->content) return 1;
- if(item1->content < item2->content) return -1;
+ return -1;
};
View How-to-setup-ghost-on-DigitalOcean-doplets.md

Hmmmm, you may have noticed that DigitalOcean provides one-step ghost blog setup -- you can directly choose Ghost 0.4.2 on Ubuntu 12.04. But, as you see, it's 12.04 which may does'nt meet our needs.
E.g. its vim version is 7.3, compiled in 2011.

So, you may think: I should customize all by myself, and certainly I can make it. Then, you would have installed everything needed. As you cd ghost && npm start, only to find :

/usr/bin/env: node: No such file or directory
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian