Skip to content

Instantly share code, notes, and snippets.

@nghuuphuoc
nghuuphuoc / 1) Install
Last active September 4, 2023 09:29
Install Redis on Centos 6
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
@bmcculley
bmcculley / markov.php
Last active May 29, 2022 19:06
PHP Markov Chain class
<?php
/*
Levi Thornton from boogybonbon and wordze generously posted his php Markov
Chain class.. unfortunately there is a missing $nn++ thus the class can hang,
the working version is below all credit to Levi for the code, i just fixed a
bug.
Example Usage:
------------------
@iamnewton
iamnewton / bash-colors.md
Last active May 2, 2024 22:42
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@carlosefonseca
carlosefonseca / json2gfmtable.py
Last active June 24, 2016 04:41
Creates a GitHub Flavored Markdown table from a JSON array passed to the stdin. Accepts a list of column names as the argument for column ordering and filtering.
#!/usr/bin/env python3
# coding=utf-8
import json
import sys
# only reads from stdin
j = json.loads(sys.stdin.read())
# reads a list of column names from the argument "col1,col2" etc
@muffycompo
muffycompo / base64_url_safe.php
Created July 10, 2014 23:05
PHP Helper functions for Safe Base64 URL encode
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
?>
@rothgar
rothgar / install-tmux
Last active April 5, 2023 06:53 — forked from ekiara/how_to_install_tmux_on_centos
Install tmux 1.9 on rhel/centos 6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
@sha1sum
sha1sum / groupme_random_fact.php
Created December 15, 2014 20:10
Random Fact Generator for a GroupMe Bot (via callback URL)
<?php
/*
* Output a random fact to GroupMe via a bot.
*
* Trigger the bot with "!randomfact" or "!random fact".
* Enter the bot ID on line 43.
*
*/
@IanSimpson
IanSimpson / imb.php
Created May 28, 2015 11:03
PHP IMB Barcode Converter
<?
/**
* IMB Converter
* =============
* This class takes a numeric code (in the valid format) and returns a string in ATDF format, ready to be printed
* with the USPS IMB font
*
* Code extracted from TCPDF and modified to operate standalone. See http://www.tcpdf.org
*
* Usage:
@jaydenseric
jaydenseric / ffmpeg-web-video-guide.md
Last active February 17, 2024 23:49
A quick guide to using FFmpeg to create cross-device web videos.

Video conversion with FFmpeg

Install

On mac:

  1. Download the latest release.
  2. Extract the binary and place it in /usr/local/bin.

Command basics

@JeffreyWay
JeffreyWay / .bash_profile
Created July 31, 2015 19:20
Prettier git logs
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"