Skip to content

Instantly share code, notes, and snippets.

@dhilip89
dhilip89 / postgres-notify-trigger.sql
Created July 9, 2017 02:48 — forked from bithavoc/postgres-notify-trigger.sql
I used this trigger to notify table changes via NOTIFY (migrating off RethinkDB)
CREATE OR REPLACE FUNCTION notify_trigger() RETURNS trigger AS $$
DECLARE
channel_name varchar DEFAULT (TG_TABLE_NAME || '_changes');
BEGIN
IF TG_OP = 'INSERT' THEN
PERFORM pg_notify(channel_name, '{"id": "' || NEW.id || '"}');
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
PERFORM pg_notify(channel_name, '{"id": "' || OLD.id || '"}');
@dhilip89
dhilip89 / README.md
Created July 9, 2017 02:50 — forked from quiver/README.md
Who says PostgreSQL can't Pub/Sub like Redis?

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
@dhilip89
dhilip89 / stuns
Created July 11, 2017 17:30 — forked from zziuni/stuns
STUN server list
# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net
@dhilip89
dhilip89 / HelloWorld.java
Created July 14, 2017 10:40 — forked from lolzballs/HelloWorld.java
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
@dhilip89
dhilip89 / hello_mesos.py
Created September 20, 2017 08:05 — forked from porterjamesj/hello_mesos.py
the tiniest mesos scheduler
import logging
import uuid
import time
from mesos.interface import Scheduler
from mesos.native import MesosSchedulerDriver
from mesos.interface import mesos_pb2
logging.basicConfig(level=logging.INFO)
@dhilip89
dhilip89 / ammojs-loading.md
Created September 23, 2017 09:49 — forked from sasha240100/ammojs-loading.md
Ammo.js loading comparison table

Comparison table of Ammo.js WebAssembly and Asm.js versions

Date: 9 January 2017

Browser: Chrome 57.0.2970.0 (Official Build) dev (64-bit)

Name WASM (WebAssembly) Asm.js
Loading time ~2.1s ~2.4s
Files used ammoloader.js [434 Kb], ammo.wasm [725 Kb] ammo.js [1.7Mb]
@dhilip89
dhilip89 / ammojs-loading.md
Created September 23, 2017 09:49 — forked from sasha240100/ammojs-loading.md
Ammo.js loading comparison table

Comparison table of Ammo.js WebAssembly and Asm.js versions

Date: 9 January 2017

Browser: Chrome 57.0.2970.0 (Official Build) dev (64-bit)

Name WASM (WebAssembly) Asm.js
Loading time ~2.1s ~2.4s
Files used ammoloader.js [434 Kb], ammo.wasm [725 Kb] ammo.js [1.7Mb]
@dhilip89
dhilip89 / what-forces-layout.md
Created December 29, 2017 13:44 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@dhilip89
dhilip89 / gradle-cheatsheet.gradle
Created January 9, 2018 17:03 — forked from jahe/gradle-cheatsheet.gradle
Gradle Cheatsheet
// imports a couple of java tasks
apply plugin: "java"
// List available tasks in the shell
> gradle tasks
// A Closure that configures the sourceSets Task
// Sets the main folder as Source folder (where the compiler is looking up the .java files)
sourceSets {
main.java.srcDir "src/main"
@dhilip89
dhilip89 / fix-infinality.md
Created March 4, 2018 06:27 — forked from cryzed/fix-infinality.md
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08: