Skip to content

Instantly share code, notes, and snippets.

#ifdef TEST
#include <stdint.h>
#include <stdio.h>
uint8_t LCDDR0=0,
LCDDR1=0,
LCDDR2=0,
LCDDR3=0,
import re
censor = lambda s: re.sub('[acemnopqrsuvwxyz]', '▄', re.sub('[bdfhijkltABCDEFGHIJKLMNOPQRSTUVWXYZ]', '█', s))
# censor('This is a test.') → '███▄ █▄ ▄ █▄▄█.'
@jaseg
jaseg / gist:1ce39aa6ee73dbfd97d0
Created May 26, 2015 11:12
Basic string interpolation in pure python
# alike https://github.com/lihaoyi/macropy#string-interpolation
In [23]: class Interpol:
def __getitem__(self, str):
import inspect
return str.format(**inspect.currentframe().f_back.f_locals)
....:
In [24]: s = Interpol()
@jaseg
jaseg / keybinding
Created April 20, 2015 11:14
fish: Remap CTRL+O to execute the current command as root
bind \co sudo-execute
#!/Hello world!
#include <stdio.h>
main(argc, argv)
int argc;
char **argv;
{
printf("Hello world\n");
}
set showtabline=never
set go-=r
set defsearch=duckduckgo
com! search-selection,ss -bang -nargs=? -complete search -js commands.execute((bang ? "open " : "tabopen " ) + args + " " + buffer.currentWord)
map <A-s> :set nss!=<A-Tab>
map <A-C-s> :set nst!=<A-Tab>
#include <unistd.h>
#include <sys/prctl.h>
#include <stdlib.h>
#include <signal.h>
void hup_handler(int signal){
exit(0);
}
int main(int argc, char **argv){
xkb_symbols "mixed" {
include "pc+jp(OADG109A)+inet(evdev)+level3(ralt_switch)+level3(lalt_switch)"
key <CAPS> { [ Escape , Eisu_toggle ] };
key <AE05> { [ 5 , percent , EuroSign ] };
key <AE11> { [ minus , equal , dead_macron ] };
key <AE12> { [ asciicircum , asciitilde , dead_circumflex ] };
key <AE13> { [ yen , bar , underscore ] };
key <AD01> { [ q , Q , adiaeresis , Adiaeresis ] };
@jaseg
jaseg / gist:8e56071398ce814511b8
Created February 4, 2015 10:21
IRC in pure bash, just with builtins
#!/bin/bash
user="crlf"
function irccmd {
echo -e "$1\r" >&3
}
function send_message {
if [ -n "$2" ]; then