Skip to content

Instantly share code, notes, and snippets.

@kamermans
kamermans / sessionclean
Created August 13, 2014 00:08
Replacement PHP session cleaner for Ubuntu (place inside /usr/lib/php5/)
#!/bin/sh
# check if file-based sessions are enabled
file_storage=$(/usr/lib/php5/sessionstorage | grep '^files$' -c)
if [ "$file_storage" = "0" ]; then
exit 0
fi
# first find all used files and touch them (hope it's not massive amount of files)
@anshula
anshula / phoronix-cmd.md
Last active March 22, 2024 21:43
Phoronix Test Suite Cheat Sheet
@freeman-lab
freeman-lab / StreamingKMeans.scala
Last active February 26, 2019 07:13
Spark Streaming + MLLib integration examples
package thunder.streaming
import org.apache.spark.{SparkConf, Logging}
import org.apache.spark.rdd.RDD
import org.apache.spark.SparkContext._
import org.apache.spark.streaming._
import org.apache.spark.streaming.dstream.DStream
import org.apache.spark.mllib.clustering.KMeansModel
import scala.util.Random.nextDouble
@XVilka
XVilka / TrueColour.md
Last active April 8, 2024 14:02
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@upsuper
upsuper / bgmrank.rb
Last active May 14, 2019 03:40
统计 Bangumi 上一个用户的收藏的评分分布情况,已移至 https://github.com/upsuper/bgmrank
#!/usr/bin/env ruby
require 'optparse'
require 'net/http'
CATEGORIES = [:anime, :book, :music, :game, :real]
STATES = [:wish, :collect, :do, :on_hold, :dropped]
progress = true
options = {
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@jboner
jboner / latency.txt
Last active May 5, 2024 03:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@josevalim
josevalim / sample output
Created May 24, 2012 17:53 — forked from alco/sample output
Updated Elixir chat demo
defmodule Chat.Client do
# In all of the following functions 'server' stands for the server's pid
def join(server) do
send server, :join
end
def say(server, message) do
send server, { :say, message }
end
@baoshan
baoshan / install-pypy.sh
Created April 24, 2012 11:23
Install PyPy on CentOS
# yum list \*openssl\*
yum install -y openssl098e
yum install -y zlib
ln -s /usr/lib64/libssl.so.0.9.8e /usr/lib64/libssl.so.0.9.8
ln -s /usr/lib64/libcrypto.so.0.9.8e /usr/lib64/libcrypto.so.0.9.8
ln -s /lib64/libbz2.so.1 /lib64/libbz2.so.1.0
wget https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux64.tar.bz2
tar -xf pypy-1.8-linux64.tar.bz2
cp -r pypy-1.8 /opt
ln -s /opt/pypy-1.8/bin/pypy /usr/local/bin
anonymous
anonymous / wordcount.clj
Created January 13, 2012 19:45
Reliable word-count topology
(ns topologies.core
(:import [backtype.storm StormSubmitter LocalCluster])
(:require [clojure.test :as test])
(:use [backtype.storm clojure config])
(:gen-class))
(def id-count (atom 0)) ;; tuple counter for debugging -- something to make ids out of
(defspout sentence-spout ["sentence"]