Skip to content

Instantly share code, notes, and snippets.

View ffledgling's full-sized avatar
🏠
🔢

Anhad Jai Singh ffledgling

🏠
🔢
View GitHub Profile
@JonCole
JonCole / Redis-BestPractices-General.md
Last active April 27, 2024 12:50
Redis Best Practices

Some of the Redis best practices content has moved

This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out : https://docs.microsoft.com/azure/azure-cache-for-redis/cache-best-practices.

NOTE: Client specific guidance listed below is still valid and should still be considered. I will update this document once all content has been moved.

@Informatic
Informatic / README.md
Last active April 9, 2024 07:09
cloud-init "nocloud" networking setup

cloud-init is absolute cancer. Its code is horrible. It has no documentation at all.

It took me 5 fucking hours to figure out how to properly configure networking on recent cloud-init (Ubuntu 16.04 cloud image) with local datasource.

It's not mentioned anywhere you need to provide dsmode: local. (but only if you need network-config, besides that everything is fine; someone below noted that -m flag does the same thing, good to know) Of course nobody needs documentation for network-config format either. (cloudinit/net/__init__.py is a protip, enjoy the feces dive)

Oh, and by the way - no, it's not possible to provide network-config to uvt-kvm without patching shit.

#!/bin/bash -e
# Test AWS credentials
if [ "$AWS_ACCESS_KEY_ID" == "" ] ; then
echo "Missing credentials";
exit 1;
fi
# Find public IP of hostname
IP=`dig +short $1`;
@izabera
izabera / csvmove
Created March 31, 2015 02:31
rearrange columns in a csv file
#!/bin/bash
# csvmove
# rearrange columns of a csv file read from stdin
# usage: csvmove column [column...]
# column arguments can be formatted like this: 1,3,3,7-10,32
# any column can be repeated more than once or skipped
if (( ! $# )); then
@hvoecking
hvoecking / translate.go
Last active March 28, 2024 13:52
Golang reflection: traversing arbitrary structures
// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//
@grenade
grenade / install-ubuntu-fonts.sh
Created September 3, 2013 10:11
Install Ubuntu fonts on Fedora / RedHat
sudo yum -y install ttmkfdir
wget http://font.ubuntu.com/download/ubuntu-font-family-0.80.zip
mkdir /tmp/ubuntu-font-family-0.80
unzip -j ubuntu-font-family-0.80.zip -d /tmp/ubuntu-font-family-0.80
rm -f ubuntu-font-family-0.80.zip
sudo mkdir /usr/share/fonts/ubuntu
sudo mv /tmp/ubuntu-font-family-0.80/*.ttf /usr/share/fonts/ubuntu
rm -rf /tmp/ubuntu-font-family-0.80
cd /usr/share/fonts/ubuntu
ttmkfdir > fonts.dir
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@alotaiba
alotaiba / google_speech2text.md
Created February 3, 2012 13:20
Google Speech To Text API

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000