Skip to content

Instantly share code, notes, and snippets.

View AndrewRose's full-sized avatar

Andrew Rose AndrewRose

View GitHub Profile
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error
@krakjoe
krakjoe / pthreads.md
Last active August 30, 2023 18:30
pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls
@philfreo
philfreo / gist:7257723
Created October 31, 2013 21:44
Facebook Perl source code from 2005. When browsing around thefacebook.com in 2005 the server spit out some server-side source code rather than running it. I believe this was for their old graph feature that let you visualize the graph between all your friends. The filename is `mygraph.svgz` and contains some gems such as a commented out "zuck" d…
#!/usr/bin/perl
use Mysql;
use strict;
use vars qw($school_name);
use vars qw($pass);
require "./cgi-lib.pl";
@LeBenLeBen
LeBenLeBen / nginx.conf
Last active April 26, 2023 10:14
Nginx rewrite rules for WordPress multisite
# WordPress multisite rewrite for subfolder install
rewrite ^/(xmlrpc\.php|wp-[0-9a-z-]+\.php) /wordpress/$1;
rewrite ^/(wp-(admin|includes).*) /wordpress/$1;
# Rewrite assets that lives in /content but has wrong URLs (YooTheme/Widgetkit)
rewrite ^(?!\/content)(?:.*)content[^.](.*) $scheme://$host/content/$1;
@vielhuber
vielhuber / script.sql
Last active December 17, 2019 12:17
mysql / postgresql: get total count 3 different alternatives with window function in one query #sql
# 2 queries (best)
SELECT col1, col2, col3 FROM bar ORDER BY col4 LIMIT 10;
SELECT COUNT(*) FROM bar;
# postgres
SELECT col1, col2, col3, count(*) OVER() AS full_count FROM bar ORDER BY col4 LIMIT 10;
# mysql (deprecated and slow!)
SELECT SQL_CALC_FOUND_ROWS col1, col2, col3 FROM bar ORDER BY col4 LIMIT 10;
SELECT FOUND_ROWS();