Skip to content

Instantly share code, notes, and snippets.

View letuananh's full-sized avatar
🎯
focusing on jamdict 0.1 stable release

Lea Tuan Anh Le letuananh

🎯
focusing on jamdict 0.1 stable release
View GitHub Profile
@letuananh
letuananh / Makefile.am
Created August 11, 2017 05:33
Hello GNU Build System
bin_PROGRAMS = uberapp
uberapp_SOURCES = main.c
@letuananh
letuananh / main.c
Created August 11, 2017 05:30
Hello C Application
#include <stdio.h>
int main (void)
{
puts ("Hello from Uber software.");
return 0;
}
@letuananh
letuananh / web-servers.md
Created July 12, 2017 09:54 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@letuananh
letuananh / .emacs
Created January 11, 2017 06:53
How to use web-mode.el in Emacs
;; download web-mode.el from http://web-mode.org/ and save it to ~/.emacs.d/custom-mode
;; (You may need to create that directory)
;; Add these following lines to ~/.emacs
(add-to-list 'load-path "~/.emacs.d/custom-mode")
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
@letuananh
letuananh / Remove Submodule
Last active September 15, 2015 03:07 — forked from kyleturner/Remove Submodule
How to remove a submodule from a Github project
Run git rm --cached <submodule name>
Delete the relevant lines from the .gitmodules file.
Delete the relevant section from .git/config.
Commit
Delete the now untracked submodule files.
Remove directory .git/modules/<submodule name>
@letuananh
letuananh / wordnet_count.py
Created September 4, 2015 04:19
Count lemmas in WordNet
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import nltk
from nltk.corpus import wordnet as wn
DOG = wn.synsets("dog")[0]
print(DOG)
from random import shuffle, randint
import re
from sets import Set
def f1(seq): # Raymond Hettinger
# not order preserving
set = {}
map(set.__setitem__, seq, [])
return set.keys()
@letuananh
letuananh / player.py
Created March 25, 2015 03:56
Demo code - Adopted from http://pastebin.com/duV5fwGh
import sys
class Player:
def __init__(self, name, age):
self.lives = 10
self.name = name
self.age = age
def eat(self, food):
if food == "apple":
@letuananh
letuananh / bank.py
Created March 11, 2015 03:53
Bank account demo
class BankAccount:
def __init__(self, initial_balance=0):
self.balance = initial_balance
def deposit(self,amount):
self.balance += amount
print("Depositted %s" % (amount,))
def withdraw(self, amount):
@letuananh
letuananh / foo.py
Created December 1, 2014 12:46
Which style do you prefer? (Please fork & add your alternative solutions if you have any)
# Solution 1
if foo:
moo = 'foo'
elif boo:
moo = 'boo'
elif bar:
moo = 'bar'
else:
moo = 'blah'