Skip to content

Instantly share code, notes, and snippets.

Latency Comparison Numbers (~2012)

Name
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cachereference 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
@egoarka
egoarka / eba.sh
Created November 30, 2018 13:38
JS alike destructuring assignment for bash
echo "33:34" | awk -F':' '{ print $1, $2 }' | read a b <<< (cat)
read c d <<< $(echo "21:22" | awk -F':' '{ print $1, $2 }')
@fnky
fnky / ANSI.md
Last active May 18, 2024 17:55
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@mykubicle
mykubicle / docker_mint_xenial_install.sh
Last active March 14, 2024 23:23
Get Docker CE for Linux Mint based on Ubuntu Xenial
#!/bin/bash
# Uninstall old version
sudo apt-get remove docker docker-engine docker.io
# Update apt package index
sudo apt-get update
# Install packages to allow apt to use a repo over HTTPS
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
# Add Docker offical GPG Key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@steven2358
steven2358 / ffmpeg.md
Last active May 10, 2024 20:57
FFmpeg cheat sheet
@rizo
rizo / Dockerfile
Last active January 19, 2023 20:14
Alpine (3.6) based docker image with Protocol Buffers compiler supporting Go.
# Protobuf Builder
# ================
#
# This image builds protocol buffers library from source with Go generation
# support. The builder and runner images are produced.
# Builder Image
# -------------
FROM golang:1.8.3-alpine3.6 as builder
@JBlond
JBlond / bash-colors.md
Last active May 17, 2024 08:00 — forked from iamnewton/bash-colors.md
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
@marcgeld
marcgeld / psRandomAlphaNumeric.ps1
Created April 5, 2017 13:05
Powershell: Generate a random Alphanumeric string
# Generate a random Alphanumeric string
Function Get-RandomAlphanumericString {
[CmdletBinding()]
Param (
[int] $length = 8
)
Begin{
@ckandoth
ckandoth / build_python_2_7.txt
Created November 29, 2016 22:12
Download, install, and build Python 2.7.10 in a local folder
# Create a folder where you want to install different Pythons, and cd into it:
# Note that it doesn't need to be your home folder. Put it wherever you want to maintain such software:
export PYTHON_BASE="$HOME/python"
mkdir -p $PYTHON_BASE
cd $PYTHON_BASE
# Download source tarball into a subfolder named src, and untar:
curl --create-dirs -L -o src/Python-2.7.10.tgz https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
cd src
tar -zxf Python-2.7.10.tgz
@akkida746
akkida746 / WsFilter.java
Created October 18, 2016 11:23
Configure Spring autowire in java Filter
public class WsFilter implements Filter {
private ApplicationContextProvider springContext;
private FilterConfig filterConfig;
private MessageFactory msgFactory = null;
private static final Logger logger_ = Logger.getLogger(WsFilter.class.getName());
private static final Logger soap_logger = Logger.getLogger("soapLogger");
@Autowired
private WsFilterHelper helper;