Skip to content

Instantly share code, notes, and snippets.

@LeeXun
LeeXun / postgres_queries_and_commands.sql
Created June 19, 2018 13:38 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@LeeXun
LeeXun / README.md
Created March 20, 2018 15:09 — forked from balupton/README.md
Node.js Best Practice Exception Handling
@LeeXun
LeeXun / gist:f068e5411a57aed6153f3f349bafefe0
Created July 21, 2016 09:29 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@LeeXun
LeeXun / c99-heap.c
Created October 8, 2015 15:13 — forked from dannvix/c99-heap.c
Simple std::priority_queue-like container implemented in C99, without error handling and thread-safety
/*
* c99-heap.c
* - Description: Simple std::priority_queue-like container implemented in C99, without error handling and thread-safety
* - Author: Shao-Chung Chen
* - License: CC0
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
@LeeXun
LeeXun / c99-vector.c
Created October 8, 2015 15:13 — forked from dannvix/c99-vector.c
Simple std::vector-like container implemented in C99, without error handling and thread-safety
/*
* c99-vector.c
* - Description: Simple std::vector-like container implemented in C99, without error handling and thread-safety
* - Author: Shao-Chung Chen
* - License: CC0
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>