Skip to content

Instantly share code, notes, and snippets.

View flyfire's full-sized avatar
🎯
Focusing

flyfire flyfire

🎯
Focusing
View GitHub Profile
@flyfire
flyfire / bash_profile.sh
Created July 24, 2011 04:00 — forked from zhasm/bash_profile.sh
common alias
#!/bin/bash
export EDITOR='/usr/bin/vim'
export PS1="\[\e[36;1m\]\u\[\e[0m\]@\[\e[32;1m\]\h\[\e[0m\]:\[\e[31;1m\]\w\[\e[0m\]\n$"
alias a=alias
a grep="grep --color=auto -s"
#ls
@flyfire
flyfire / lazyExtract.sh
Created July 30, 2011 08:57
懒人解压缩
##Add this into your ~/.bashrc
##Usage: extract filename
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 && cd $(basename "$1" .tar.bz2) ;;
*.tar.gz) tar xvzf $1 && cd $(basename "$1" .tar.gz) ;;
*.tar.xz) tar Jxvf $1 && cd $(basename "$1" .tar.xz) ;;
*.bz2) bunzip2 $1 && cd $(basename "$1" /bz2) ;;
*.rar) unrar x $1 && cd $(basename "$1" .rar) ;;
layout title date comments categories
post
Installing Octopress (Fedora Version)
2012-02-05 06:13
true
fedora linux octopress ruby rvm jekyll rubygems

I (rather obviously) recently found myself attempting to install Octopress. Sure, it has great documentation, but some areas were lacking -- specifically, initial setup. As someone who has not worked with Ruby before other than a rather limited Windows install for a jekyll project, I had virtually no experience installing Ruby, using RVM, or even playing with RubyGems.

@flyfire
flyfire / Markdown.sublime-build
Created March 31, 2012 03:43 — forked from dvhthomas/Markdown.sublime-build
Pandoc powered Sublime Text 2 build provider for Markdown files: HTML the easy way
{
"cmd": ["pandoc.exe", "--to=html", "--output=$file.html", "$file"],
"selector": "source.md"
}
@flyfire
flyfire / NSProcessInfo.m
Created August 2, 2012 16:14
Objective-C:NSProcessInfo
#import <Foundation/Foundation.h>
int main(int argc, char const *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSFileManager *fm;
NSString *src,*dst;
BOOL isDir;
NSProcessInfo *proc = [NSProcessInfo processInfo];
@flyfire
flyfire / AddressBook.m
Created August 2, 2012 16:16
Objective-C:AddressBook
#import <Foundation/Foundation.h>
@interface AddressCard:NSObject{
NSString *name;
NSString *email;
}
-(void) setName:(NSString *) theName andEmail:(NSString*) theEmail;
-(void) setName:(NSString *) theName;
-(void) setEmail:(NSString *) theEmail;
-(NSString*) name;
@flyfire
flyfire / fetch_by_name.rb
Created August 3, 2012 13:08 — forked from hooopo/fetch_by_name.rb
fetch_by_name
# -*- encoding : utf-8 -*-
module FetchByName
def fetch_by_name(name, field_name = :name)
if id = Rails.cache.read("cached_#{self.name}_#{field_name}_#{name}")
self.find(id)
else
record = self.where(field_name => name).first || raise(ActiveRecord::RecordNotFound)
record.tap{|record| Rails.cache.write("cached_#{self.name}_#{field_name}_#{name}", record.id)}
end
end
@flyfire
flyfire / SIGABT
Created August 17, 2012 06:41
SIGABT in XCode4.4
2012-08-17 14:40:23.028 SimpleWebBrowser[2901:303] An uncaught exception was raised
2012-08-17 14:40:23.029 SimpleWebBrowser[2901:303] *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (WebView)
2012-08-17 14:40:23.033 SimpleWebBrowser[2901:303] (
0 CoreFoundation 0x00007fff89fc0716 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff84376470 objc_exception_throw + 43
2 CoreFoundation 0x00007fff89fc04ec +[NSException raise:format:] + 204
3 Foundation 0x00007fff8b128b83 _decodeObjectBinary + 2559
4 Foundation 0x00007fff8b129a16 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1189
5 Foundation 0x00007fff8b129f88 -[NSArray(NSArray) initWithCoder:] + 538
6 Foundation 0x00007fff8b128c39 _decodeObjectBinary + 2741
@flyfire
flyfire / antispam.py
Created August 22, 2012 13:00 — forked from zhasm/antispam.py
get unread Gmails, print the Subject, From, To, Message-ID, without modifying the gmails' flags.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import imaplib2 as imaplib
from email import Header
from email.parser import Parser
##USER CONFIG
HOST = 'imap.gmail.com'