Skip to content

Instantly share code, notes, and snippets.

View nhanb's full-sized avatar

Nhân nhanb

View GitHub Profile
@nhanb
nhanb / scrape.py
Created April 2, 2014 07:10
Scrape RMIT courses
from bs4 import BeautifulSoup as bs
import re
import json
import requests
# the "Cookie" header when requesting start_page
start_page_cookie = 'rmit_logout=1....'
# "Cookie" header when requesting sth like rmit.edu.au/courses/039986
detail_page_cookie = 'BIGipServer~Misc~webpub.rmit.....'
@nhanb
nhanb / kissthumbs.user.js
Last active August 29, 2015 13:56
Kissmanga Userscript - Show thumbnails in /MangaList
// ==UserScript==
// @name Kissmanga show thumbs
// @namespace http://nerdyweekly.com
// @version 0.1
// @description It's obvious
// @match http://kissmanga.com/MangaList*
// @match http://kissmanga.com/Genre*
// @copyright public domain
// ==/UserScript==
#!/usr/bin/env bash
mkdir ~/tmp_fonts
cd ~/tmp_fonts
curl -O https://aur.archlinux.org/packages/tt/ttf-win7-fonts/ttf-win7-fonts.tar.gz
tar -xvzf ttf-win7-fonts.tar.gz && cd ttf-win7-fonts
# The following assumes you have all your Windows fonts inside ~/win_fonts
src_path=/home/$USER/win_fonts
@nhanb
nhanb / party_roles.md
Last active December 29, 2015 01:58
ITC Party assignments

Hiếu

  • Than, củi, cồn,

Trường

  • Đá
  • Li, dĩa nhựa, đũa
  • Bao tay, xiên nướng

Tuấn

  • Nước ngọt
@nhanb
nhanb / Makefile
Created November 19, 2013 15:02
quick-and-dirty makefile (I mean it)
CC = g++
FLAGS = -Iinclude -L. -ltcod -ltcodxx -Wl,-rpath=. -Wall -g
OBJS = src/*.cpp
all: $(OBJS)
$(CC) $(OBJS) -o locknchase $(FLAGS)
clean:
rm -f locknchase
run: all
./locknchase
@nhanb
nhanb / konami.js
Last active December 22, 2015 13:59
/**
* Trigger something totally inappropriate when user enters the
* right sequence of the Konami code.
*
* callback is the function you want to execute when the complete sequence
* has been entered.
*/
var konamiCode = function(callback) {
@nhanb
nhanb / rmitproxy_public.sh
Last active December 18, 2015 20:29
For RMIT proxy use. Execute this script everytime you open a new terminal.
#!/bin/bash
# =============================================================================
# If the computer is currently connected to RMIT's network then this
# script will set the appropriate proxy environment variables, otherwise
# it just unsets everything.
#
# Also includes special proxy configs for:
# - git
# - apt
@nhanb
nhanb / justinguitar.py
Last active May 24, 2018 08:01
Grabbing all lesson videos from justinguitar's beginner course
#!/usr/bin/env python
import requests
import re
from bs4 import BeautifulSoup
from subprocess import call, check_output
import string
def fetch_html(links):
import java.awt.Color;
public class MovingRectangle {
/**
* method: showAnimation
* This method shows an animation in which a rectangle moves around, inside and close to
* the edges of an open window.
* Eveytime the rectangle changes the moving direction, its color is changed
* to the next color in the specified array. If there is no more color in the array,