Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
#!/usr/bin/env ruby
require 'net/telnet'
cache_dump_limit = 100
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3)
slab_ids = []
localhost.cmd("String" => "stats items", "Match" => /^END/) do |c|
matches = c.scan(/STAT items:(\d+):/)
slab_ids = matches.flatten.uniq
end
@jayzeng
jayzeng / curl.md
Created May 27, 2013 01:59 — forked from btoone/curl.md

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
Your YC username:
Company name:
Company url, if any:
Phone number(s):
Please enter the url of a 1 minute unlisted (not private) YouTube video introducing the founders. (Instructions.)
YC usernames of all founders, including you, e1ven, separated by spaces. (That's usernames, not given names: "bksmith," not "Bob Smith." If there are 3 founders, there should be 3 tokens in this answer.)
YC usernames of all founders, including you, e1ven, who will live in the Bay Area January through March if we fund you. (Again, that's usernames, not given names.)
What is your company going to make?
If this application is a response to a YC RFS, which one?
For each founder, please list: YC username; name; age; year of graduation, school, degree and subject for each degree; email address; personal url, github url, facebook id, twitter id; employer and title (if any) at last job before this startup. Put unfinished degrees in parens. List the main contact first. Separate founders with blank lines. Put an asterisk before t
@jayzeng
jayzeng / curl.md
Created April 20, 2014 22:38 — forked from btoone/curl.md

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
#!/bin/bash
# ========================================
# Testing completion suggest in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/hotels
curl -X PUT localhost:9200/hotels -d '
{
"mappings": {
"hotel" : {
This is an example how to perform multi-select faceting in ElasticSearch.
Selecting multiple values from the same facet will result in an OR filter between each of the values:
(facet1.value1 OR facet1.value2)
Faceting on more than one facet will result in an AND filter between each facet:
(facet1.value1 OR facet1.value2) AND (facet2.value1)
I have chosen to update the counts for each facet the selected value DOES NOT belong to since we are performing an AND between each facet. I have included an example that shows how to keep the counts if you don't want to do this (filter0.sh).
@jayzeng
jayzeng / app.js
Created April 28, 2014 22:39 — forked from egaumer/app.js
/*jshint globalstrict:true */
/*global angular:true */
'use strict';
angular.module('demo', [
'demo.controllers',
'demo.directives',
'elasticjs.service'
]);
@jayzeng
jayzeng / recover_source_code.md
Created March 12, 2017 08:04 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@jayzeng
jayzeng / pedantically_commented_playbook.yml
Created April 5, 2017 23:32 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.