Skip to content

Instantly share code, notes, and snippets.

@mikeyk
mikeyk / gist:1329319
Created October 31, 2011 22:56
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@umidjons
umidjons / youtube-dl-download-audio-only-on-best-quality.md
Last active March 9, 2024 07:54
Download Audio from YouTube with youtube-dl

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@sgmurphy
sgmurphy / url_slug.js
Created July 12, 2012 02:05
URL Slugs in Javascript (with UTF-8 and Transliteration Support)
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
@alexjs
alexjs / cors-nginx.conf
Created November 28, 2012 22:42 — forked from michiel/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
$siren = mt_rand(100000000, 999999999);
$key = (12 + 3 * ($siren % 97)) % 97;
print 'FR' . $key . $siren;
@sgmurphy
sgmurphy / podcast-ratings.php
Created February 21, 2012 19:31
Scrape ratings from iTunes store
<?php
/**
* Scrape the number of podcast reviews from iTunes for all country specific storefronts.
*
* @author Sean Murphy <sean@iamseanmurphy.com>
*/
$podcast_id = '366931951'; // Startups For the Rest of Us
//$podcast_id = '318567721'; // techzing
@grncdr
grncdr / data.csv
Created June 17, 2015 22:29
Demo of importing a CSV file into a Contentful space
first name last name age
Stephen Sugden 31
Tom Reznik 29
Justin Thomas 30
@oroce
oroce / nginx.conf
Created January 31, 2014 20:40
nginx config for using grafana, elasticsearch and graphite with authentication.
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;
@vladholubiev
vladholubiev / aws-lambda-libraries.txt
Last active July 24, 2022 15:51 — forked from gojko/gist:aaea440be880d0162767639f8a6681f9
Libraries available in AWS Lambda
# AWS Lambda `ldconfig -p`, region `us-east-1`, nodejs 8.10 runtime, 22 May 2019, Amazon Linux 2018.03
# See https://github.com/claudiajs/lambda-vm-info for how this was generated and to create an updated version
241 libs found in cache `/etc/ld.so.cache'
libz.so.1 (libc6,x86-64) => /lib64/libz.so.1
libxslt.so.1 (libc6,x86-64) => /usr/lib64/libxslt.so.1
libxshmfence.so.1 (libc6,x86-64) => /usr/lib64/libxshmfence.so.1
libxml2.so.2 (libc6,x86-64) => /usr/lib64/libxml2.so.2
libxcb.so.1 (libc6,x86-64) => /usr/lib64/libxcb.so.1
libxcb-xvmc.so.0 (libc6,x86-64) => /usr/lib64/libxcb-xvmc.so.0
@markwalkom
markwalkom / logstash.conf
Last active April 29, 2022 10:23
Reindexing Elasticsearch with Logstash 2.0
input {
elasticsearch {
hosts => [ "HOSTNAME_HERE" ]
port => "9200"
index => "INDEXNAME_HERE"
size => 1000
scroll => "5m"
docinfo => true
scan => true
}