Skip to content

Instantly share code, notes, and snippets.

View hlthi's full-sized avatar

Muhammet Öztürk hlthi

  • Trabzon-Ankara,Turkey
View GitHub Profile
@mettledrum
mettledrum / gist:a6107e0de98140b42222
Last active April 24, 2018 06:25
example of using pprof
package main
import (
"runtime/pprof"
"fmt"
"net/http"
"os"
"time"
)
@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@krakjoe
krakjoe / pthreads.md
Last active September 23, 2025 16:14
pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls
@pedro-stanaka
pedro-stanaka / postgisToLatLngArray
Last active June 18, 2018 07:57
A fast way to transform a PostGIS polygon in WKT format to Javascript (Google Maps API)
/**
* Get an polygon postgis object casted to a string and transform to an instance of
* google.maps.polygon
* @author Pedro Tanaka <pedro.stanaka@gmail.com>
* @param {String} polygonStr String from the PostGis function TS_geometryToText(...)
* @returns {Array} An array with the LatLng's to be put in the polygon
*/
function postgisPolygonToJsonArray(polygonStr){
polygonStr = polygonStr.replace('POLYGON((', '');
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active December 5, 2025 09:56
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), 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(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@conorbuck
conorbuck / angle-between-points.js
Created May 5, 2012 22:51
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@dtrce
dtrce / mp3.js
Created September 8, 2011 18:39
streaming mp3 using nodejs
var http = require('http'),
fileSystem = require('fs'),
path = require('path')
util = require('util');
http.createServer(function(request, response) {
var filePath = 'path_to_file.mp3';
var stat = fileSystem.statSync(filePath);
response.writeHead(200, {