Skip to content

Instantly share code, notes, and snippets.

View hugo53's full-sized avatar
🏆
On new thing

Hoang Nguyen hugo53

🏆
On new thing
View GitHub Profile
from scrapy.spider import BaseSpider
from scrapy.http import FormRequest, Request
from scrapy.selector import HtmlXPathSelector
class DjangoSpider(BaseSpider):
domain_name = "django.local"
start_urls = ["http://localhost:8000/admin/"]
extra_domain_names = ["localhost"]
def parse(self, response):
@hugo53
hugo53 / Listuser
Created March 9, 2012 07:02
List all users in linux
cat /etc/passwd | gawk 'FS=":" {print $1}'
gawk -F: '{ print $1 }' /etc/passwd
alias userlist='cat /etc/passwd |grep "/bin/bash" |grep "[5-9][0-9][0-9]" |cut -d: -f1'
@hugo53
hugo53 / Install Jekyll
Last active December 27, 2015 20:09
Install Jekyll
1. Install RVM
\curl -L https://get.rvm.io | bash -s stable
2. Install Ruby 1.9.2
rvm install 1.9.2
3. Make default
rvm --default 1.9.2
4. Install jekyll
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;
@hugo53
hugo53 / Git useful case.md
Last active December 29, 2015 05:49
Git manually

Committed commit A, but not pushed A. Want to delete the commit A because of some reasons.

git reset --hard HEAD^

When use cocoapods, must have a tag. Therefore, must create tag

git tag 1.0.0[tag version] -a
@hugo53
hugo53 / Mac Commands.md
Last active December 29, 2015 12:49
Mac commands

Download a file quickly

curl -O https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py

Note that -O is O character (uppercase), not zero number

@hugo53
hugo53 / Xcode Snippets.md
Last active January 1, 2016 04:29
Xcode snippets

Code Snippet with Xcode

Create Snippet

Highlight code and drag to Code Snippet in Xcode (lower right corner)

Delete Snippet

Click on snippet and press Delete

Get snippet files for backup purpose

@hugo53
hugo53 / vi.md
Last active August 29, 2015 13:57
Hugo Nguyen

Hi,

I'm Hugo, a Cu-liii at YLLabs.

Now I'm working as iOS Engineer in our private business.

Please check out our product, YLNews.

I'm also very keen on Hacker News and read tech/business articles.