Skip to content

Instantly share code, notes, and snippets.

View mimoo's full-sized avatar
🦀
求同存异

David Wong mimoo

🦀
求同存异
View GitHub Profile
@mimoo
mimoo / gist:9907534
Last active August 29, 2015 13:57
Select closest word to cursor in textarea (like ctrl+D in sublime text)
var textarea = textarea
// detect dots and comas
function trimtrim (truc) {
truc = $.trim(truc)
truc = truc.replace(/\./, "");
truc = truc.replace(/\,/, "");
truc = truc.replace(/\;/, "");
return truc
}
@mimoo
mimoo / gist:9907585
Created April 1, 2014 04:15
trouver des synonymes en donnant un mot
import urllib2
import sys
import re
req = urllib2.Request('http://www.cnrtl.fr/synonymie/' + sys.argv[1])
res = urllib2.urlopen(req)
data = res.read()
m = re.findall(r"/synonymie/(\w+)/", data)
print(m)
@mimoo
mimoo / mp3
Created April 19, 2014 17:18
get list of mp3s from mp3skull.com
import urllib2
import sys
import re
truc = re.sub(r" ", "_", sys.argv[1])
req = urllib2.Request('http://mp3skull.com/mp3/' + truc + '.html')
res = urllib2.urlopen(req)
data = res.read()
m = re.findall(ur"(http.*\.mp3)\"", data)
@mimoo
mimoo / tool.py
Last active September 7, 2019 11:11
encrypt with AES in python using pycrypto lib
import argparse, os, sys
from Crypto.Cipher import AES
from Crypto.Hash import HMAC
from Crypto.Protocol.KDF import PBKDF2
# check arguments
parser = argparse.ArgumentParser()
parser.add_argument("file", help="the file we want to encrypt/decrypt")
parser.add_argument("key", help="your key")
(require 'package)
;; melpa !!
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
'("marmalade" .
"http://marmalade-repo.org/packages/"))
;; C indent style is better like this
(setq c-default-style "linux"
c-basic-offset 4)
### Keybase proof
I hereby claim:
* I am mimoo on github.
* I am mimoo (https://keybase.io/mimoo) on keybase.
* I have a public key whose fingerprint is C11E D67D E493 0E15 DEAD 2474 9A84 B86A EEB7 278E
To claim this, I am signing this object:
@mimoo
mimoo / gist:c7c184bef5cd9f9d908a
Last active August 29, 2015 14:12
RSS Feed with CodeIgniter + Twig
rss.xml:
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>your title</title>
<link>http://www.example.com/</link>
<description>your description</description>
<language>en-us</language>
<lastBuildDate>{{updated}}</lastBuildDate>
@mimoo
mimoo / py2pdf
Created March 7, 2015 16:40
python source code printed to pdf file
vim abc.py -c ":hardcopy > abc.ps" -c ":q"
ps2pdf abc.ps abc.pdf
@mimoo
mimoo / plaidctf.sage
Last active May 2, 2016 10:34
plaid
# plaid ctf triplets
data = [
[0xfd2066554e7f2005082570ddf50e535f956679bf5611a11eb1734268ffe32eb0f2fc0f105dd117d9d739767f300918a67dd97f52a3985483aca8aa54998a5c475842a16f2a022a3f5c389a70faeaf0500fa2d906537802ee2088a83f068aba828cc24cc83acc74f04b59a0764de7b64c82f469db4fecd71876eb6021090c7981, 0xa23ac312c144ce829c251457b81d60171161655744b2755af9b2bd6b70923456a02116b54136e848eb19756c89c4c46f229926a48d5ac030415ef40f3ea185446fa15b5b5f11f2ec2f0f971394e285054182d77490dc2e7352d7e9f72ce25793a154939721b6a2fa176087125ee4f0c3fb6ec7a9fdb15510c97bd3783e998719, 0x593c561db9a04917e6992328d1ecadf22aefe0741e5d9abbbc12d5b6f9485a1f3f1bb7c010b19907fe7bdecb7dbc2d6f5e9b350270002e23bd7ae2b298e06ada5f4caa1f5233f33969075c5c2798a98dd2fd57646ad906797b9e1ce77194791d3d0b097de31f135ba2dc7323deb5c1adabcf625d97a7bd84cdf96417f05269f4],
[0xcb26469a1b726d964cc0d3c8f2e486860b7252643b3c974857abc04cc93eca7167138e0cc5cbaa39b4c47daa6ccc5d546d6bfd4171f3ed3f1b0bfe30c22010e3376ec551ba46380cfa25495c7b1299ae7b02409523845fc1b3ccba46a19a4f58dd92c330a
@mimoo
mimoo / Quotes.md
Last active November 29, 2015 02:55
Quotes

Social:

I don't believe in awkwardness.

-Oscar Carlos (a friend)

Do I not destroy my enemies when I make them my friends?

-Lincoln