Skip to content

Instantly share code, notes, and snippets.

@yuan3y
yuan3y / git-line-add-delete-per-day.sh
Created April 14, 2017 09:48
Get number of lines added and deleted per day from your git repo
#!/bin/bash
ds() {
date --date="$1 days ago" +%Y-%m-%d
}
BRANCH=master # your branch here
echo "Date,LinesAdded,LinesDeleted"
for day in $(seq 1 10)
@yuan3y
yuan3y / Countries.csv
Last active February 3, 2017 10:52 — forked from lenguyenthedat/Countries.csv
Country - Continent codes and names
continent_code country_code continent_name country_name country_iso3 country_number country_full_name
AS AF Asia Afghanistan AFG 004 Islamic Republic of Afghanistan
EU AX Europe Åland Islands ALA 248 Åland Islands
EU AL Europe Albania ALB 008 Republic of Albania
AF DZ Africa Algeria DZA 012 People's Democratic Republic of Algeria
OC AS Oceania American Samoa ASM 016 American Samoa
EU AD Europe Andorra AND 020 Principality of Andorra
AF AO Africa Angola AGO 024 Republic of Angola
NA AI North America Anguilla AIA 660 Anguilla
AN AQ Antarctica Antarctica ATA 010 Antarctica the territory South of 60 deg S

Keybase proof

I hereby claim:

  • I am yuan3y on github.
  • I am yuan3y (https://keybase.io/yuan3y) on keybase.
  • I have a public key ASDBewNdhcburdGvMJjW-fbI-JCBnstboMjRQWSaTOtWVQo

To claim this, I am signing this object:

@yuan3y
yuan3y / test.c
Created November 21, 2015 18:05
c string concept
#include <stdio.h>
int main (void)
{
char *a[2][3] = {"abc","defgi","ijkl","mnopqr","stuvm","xyz"};
printf("%c",***(a+1) );
}
@yuan3y
yuan3y / hdb_num_flat.py
Created June 12, 2015 06:06
Get the Number Of Units in Each HDB Flat Within a Range of Postal Code in Singapore
__author__ = 'yuan3y'
import xml.etree.ElementTree as ET
import urllib.request as re
import datetime
for post_code in range(510000,530000):
current_time = datetime.datetime.now()
unix_timestamp = str(int(current_time.timestamp() * 1000))
postal_code = str(post_code)
@yuan3y
yuan3y / sublime_text_Chinese_fcitx_input.sh
Created May 13, 2015 17:57
install fcitx Chinese input usable in sublime text 3
git clone https://github.com/SanCoder-Q/sublime_zh_patch.git
cd sublime_zh_patch
sudo ./setup.sh
sudo apt-get install fcitx fcitx-config-gtk fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-table-wubi
@yuan3y
yuan3y / most_command.sh
Created February 11, 2015 02:05
find my most used linux commands in bash shell
history | awk '{if ($2=="sudo") {CMD[$3]++;} else {CMD[$2]++;} count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
@yuan3y
yuan3y / transfer-wordpress.txt
Created February 9, 2015 16:19
8 Things to do to Transfer Wordpress between Self-Hosted Sites
1. Export from Tools > Export in the old host, just keeping all the default options.
2. Download the wordpress folder from old host via FTP
3. Set up my new host and uploaded the folder via FTP
4. Removed wp-config.php
5. Install wordpress by opening up the browser to my new site
6. Enable the plugins I have
7. Tools > Import > Wordpress
8. Update Wordpress and plugins
@yuan3y
yuan3y / abcd.py
Last active August 29, 2015 14:10
abcd*e=dcba for ntu coe fb page
__author__ = 'yuan3y'
for i in range(1023, 4987):
for j in range(2, 10):
if i * j > 9999 or str(i).find(str(j)) > 0:
break
if str(i)[-1::-1] == str(i * j):
print(i, j, i * j)
@yuan3y
yuan3y / coe_keypad_for_a_safe_solution.cpp
Last active August 29, 2015 14:08
answer to a simple question
/*question: https://www.facebook.com/NTUCollegeOfEngineering/photos/a.373330716093099.88586.332131500213021/709453819147452/?type=1
answered by yuan3y
*/
#include<iostream>
#include<vector>
#include<stack>
#include<string>
#include<vector>
using namespace std;
int map[7][7] = {