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)
(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 / 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

@mimoo
mimoo / test.sage
Last active February 5, 2016 17:53
check new socat's dh2048_p
# socat's new dh params
dh2048_p = 0x00dc216456bd9cb2acbec998ef953e26fab557bcd9e675c043a21c7a85df34ab57a8f6bcf6847d056904834cd556d385090a08ffb537a1a38a370446d2933196f4e40d9fbd3e7f9e4daf08e2e8039473c4dc0687bb6dae662d181fd847065ccf8ab50051579bea1ed8db8e3c1fd32fba1f5f3d15c13b2c8242c88c87795b38863aebfd81a9baf7265b93c53e03304b005cb6233eea94c3b471c76e643bf89265ad606cd47ba9672604a80ab206ebe07d90ddddf5cfb4117cabc1a384be2777c7de20576647a735fe0d6a1c52b858bf2633815eb7a9c0ee581174861908891c370d524770758ba88b3011713662f07341ee349d0a2b674e6aa3e299921bf5327363
dh2048_g = 2
# is_prime(dh2048_p) -> True
q = (dh2048_p - 1) / 2
print is_prime(q) # -> False
@mimoo
mimoo / Babai_for_CVP.tex
Last active March 29, 2016 17:37
contributions for Tikz for cryptographers
\begin{tikzpicture}
\begin{scope}[scale=.28,local bounding box=scope1]
\coordinate (Origin) at (0,0);
\coordinate (XAxisMin) at (-1,0);
\coordinate (XAxisMax) at (10,0);
\coordinate (YAxisMin) at (0,-1);
\coordinate (YAxisMax) at (0,10);
\draw [thin, black!40, <->] (XAxisMin) -- (XAxisMax);% Draw x axis
@mimoo
mimoo / plaidctf.sage
Last active May 2, 2016 10:34
plaid
# plaid ctf triplets
data = [
[0xfd2066554e7f2005082570ddf50e535f956679bf5611a11eb1734268ffe32eb0f2fc0f105dd117d9d739767f300918a67dd97f52a3985483aca8aa54998a5c475842a16f2a022a3f5c389a70faeaf0500fa2d906537802ee2088a83f068aba828cc24cc83acc74f04b59a0764de7b64c82f469db4fecd71876eb6021090c7981, 0xa23ac312c144ce829c251457b81d60171161655744b2755af9b2bd6b70923456a02116b54136e848eb19756c89c4c46f229926a48d5ac030415ef40f3ea185446fa15b5b5f11f2ec2f0f971394e285054182d77490dc2e7352d7e9f72ce25793a154939721b6a2fa176087125ee4f0c3fb6ec7a9fdb15510c97bd3783e998719, 0x593c561db9a04917e6992328d1ecadf22aefe0741e5d9abbbc12d5b6f9485a1f3f1bb7c010b19907fe7bdecb7dbc2d6f5e9b350270002e23bd7ae2b298e06ada5f4caa1f5233f33969075c5c2798a98dd2fd57646ad906797b9e1ce77194791d3d0b097de31f135ba2dc7323deb5c1adabcf625d97a7bd84cdf96417f05269f4],
[0xcb26469a1b726d964cc0d3c8f2e486860b7252643b3c974857abc04cc93eca7167138e0cc5cbaa39b4c47daa6ccc5d546d6bfd4171f3ed3f1b0bfe30c22010e3376ec551ba46380cfa25495c7b1299ae7b02409523845fc1b3ccba46a19a4f58dd92c330a