Skip to content

Instantly share code, notes, and snippets.

val314159 val314159

View GitHub Profile
@val314159
val314159 / +README.md
Created Dec 9, 2018 — forked from quiver/README.md
Who says PostgreSQL can't Pub/Sub like Redis?
View +README.md

Pub/Sub pattern with PostgreSQL's LISTEN/NOTIFY command

This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.

Publish

publish message to foo channel from user nickname.

$ python pub.py foo nickname
PUBLISH to channel #foo
@val314159
val314159 / Dockerfile
Created Oct 19, 2018
emscripten Dockerfile, slightly updated
View Dockerfile
FROM buildpack-deps:bionic
RUN apt-get -y update && apt-get -y upgrade && apt-get -y install apt-utils
SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8
RUN mkdir -p /root/emscripten/
COPY emscripten /root/emscripten/
RUN cd /root/ \
@val314159
val314159 / Makefile
Created Oct 18, 2018
Let's get explicit
View Makefile
PROG=hi
all: test
test: $(PROG) ; ./$(PROG)
clean: ; rm -fr *.{o,a,so} *~ $(PROG)
hi: hi.o
$(LD) $(LDFLAGS) $^ -o $@
hi.o: hi.c
$(CC) $(CFLAGS) -c $^ -o $@
@val314159
val314159 / Makefile
Created Oct 18, 2018
Real Quick Example
View Makefile
PROG=hi
all: test
test: $(PROG) ; ./$(PROG)
clean: ; rm -fr *.{o,a,so} *~ $(PROG)
@val314159
val314159 / .emacs
Created Oct 18, 2018
add this to your .emacs file
View .emacs
;; elisp macro for Ctrl-Z makes
(defun make ()
(interactive)
(compile "makex"))
(global-set-key (kbd "C-z") 'make)
@val314159
val314159 / makex
Last active Oct 20, 2018
make utility
View makex
#!/usr/bin/env python
import os, sys
while 1:
if 'Makefile' in os.listdir('.'):
os.execlp('make', *sys.argv)
elif os.path.realpath('.') == '/':
raise SystemExit("Error: '%s' Not Found" % Makefile)
os.chdir('..')
View .emacs
;;(Setqyanssh://git@git.cnvrmedia.net:7999/~jward/docker-airflow-sandbox.git backup-directory-alist `(("." . "~/.saves")))
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
(set-face-attribute 'default nil :font "Menlo-14")
(setq initial-frame-alist
@val314159
val314159 / Makefile
Created Oct 14, 2018
cool emcc makefile
View Makefile
DOPTS=-v "`pwd`:/src" --name em trzeci/emscripten
EMCC=docker exec em emcc -Os
# -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap","ccall"]'
all: clean main0.html twelve.bc eleven.js
node main1.js
main0.html: main0.bc eleven.bc twelve.bc
$(EMCC) $? -o $@ -s EXPORTED_FUNCTIONS=@main0.json
main1.html: main1.bc eleven.bc twelve.bc
$(EMCC) $? -o $@ -s EXPORTED_FUNCTIONS=1main0.json
%.js: %.bc ; $(EMCC) $? -o $@ -s EXPORTED_FUNCTIONS=@$*.json
View .gitignore
*.pyc
*.yky
*~
.ssh
.gitignore
.gitconfig
.ve
.ve2
.ve3
@val314159
val314159 / usleep.c
Created Mar 29, 2018
usleep, what every unix should have
View usleep.c
/*
cc -o usleep usleep.c && cp usleep /usr/local/bin
*/
#include <unistd.h>
#include <stdlib.h>
int main(int c,char*v[]){
usleep(atoi(v[1]));
}
You can’t perform that action at this time.