Skip to content

Instantly share code, notes, and snippets.

@crioux
crioux / gist:e72f7087a2257f3bfdf0cc8a7cb2461e
Created May 15, 2017 04:43
Javascript method names abbreviator
//shrink=n=>n[0]+n.split('').map(c=>(c<='Z')?c:'').join('')
//keys = (_=o=>o?Object.keys(o).concat(_(o.__proto__)):[])
//abbrev=function(x) { keys(x).forEach(k=>(x[shrink(k)]=x[k])) }
//shrink=n=>n[0]+n.split('').map(c=>(c<='Z')?c:'').join('')
//abbrev=function(x) { (_=o=>o?Object.keys(o).concat(_(o.__proto__)):[])(x).forEach(k=>(x[shrink(k)]=x[k])) }
abbrev=function(x) { (_=o=>o&&(Object.keys(o).forEach(k=>(x[(n=>n[0]+n.split('').map(c=>(c<='Z')?c:'').join(''))(k)]=x[k])),_(o.__proto__)))(x) }
@crioux
crioux / activate.sh
Last active September 19, 2017 16:42
Virtualenv Shell Wrapper
#!/usr/bin/env bash
bash --init-file bin/activate
#include <iostream>
#include <string>
struct F
{
int x, e, t, f;
F(int n, int i = 1) : x(i), e(n), t(1), f(1) {}
F begin() { return F(e); }
F end() { return F(e, e); }
F &operator++()
@crioux
crioux / lattice_diamond_monokai_colors.txt
Created September 26, 2017 05:12
Monokai Colors for Lattice Diamond Source Editor
# Edit your %APPDATA%\Roaming\LatticeSemi\SRC_EDITOR.ini and put these in the right place at the bottom of the file.
[Color]
Plain%20Text=@Variant(\0\0\0\x43\x1\xff\xff\xf8\xf8\xf8\xf8\xf2\xf2\0\0)
Comment=@Variant(\0\0\0\x43\x1\xff\xff\xf9\xf9&&rr\0\0)
Keyword=@Variant(\0\0\0\x43\x1\xff\xff\xf8\xf8\xf8\xf8\xf2\xf2\0\0)
Number=@Variant(\0\0\0\x43\x1\xff\xff\x66\x66\xd9\xd9\xef\xef\0\0)
String=@Variant(\0\0\0\x43\x1\xff\xff\xa6\xa6\xe2\xe2..\0\0)
Preprocessor%20Keyword=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\xe7\xe7\x92\x92\0\0)
Selected%20Text%20Foreground=@Variant(\0\0\0\x43\x1\xff\xff\xf8\xf8\xf8\xf8\xf2\xf2\0\0)
### Keybase proof
I hereby claim:
* I am crioux on github.
* I am dildog (https://keybase.io/dildog) on keybase.
* I have a public key ASD4rV9iukMIm9tjqt1YLgf1HC-deCdhITvwxwOfQsy65go
To claim this, I am signing this object:
@crioux
crioux / command_random.py
Last active July 7, 2019 18:13
Plorp Slack Bot
import random
import logging
from slack_tools import conversationsMembers, usersInfo
def command_random(args, channel):
"""Random: Print the list of users in a channel in a random order
"""
resp = conversationsMembers(channel)
# log into pixabay and store your cookies in cookies.txt in the following format:
#
# __cfduid=xxx
# cf_use_ob=0
# client_width=3423
# csrftoken=xxx
# g_rated=
# is_human=1
# sessionid="xxxx"
#
flowchart LR
    A-->B
    B-->C
    C-->D
    click A callback "Tooltip for a callback"
    click B "https://www.github.com" "This is a tooltip for a link"
    click C call callback() "Tooltip for a callback"
    click D "https://notebooks.githubusercontent.com/view/ipynb?browser=chrome&color_mode=auto&commit=4c83e187096201f6ed159a083f615bfecebadf9c&device=unknown&enc_url=68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f64732d6d6f64756c65732f646174612d3461632f346338336531383730393632303166366564313539613038336636313562666563656261646639632f6e6f7465626f6f6b312f6e6f7465626f6f6b312e6970796e62&logged_in=false&nwo=ds-modules%2Fdata-4ac&path=notebook1%2Fnotebook1.ipynb&platform=android&repository_id=293931887&repository_type=Repository&version=98" "This is a tooltip for a link"