Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active July 27, 2024 12:32
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
@drewkerrigan
drewkerrigan / gist:2876196
Created June 5, 2012 16:51
Swift Usage Examples
Execute the following command and make a note of X-Auth-Token. You will need this token to use in all subsequent commands.
curl -v -H 'X-Storage-User: system:root' -H 'X-Storage-Pass: testpass' http://10.80.83.68:8077/auth/v1.0
In the following command examples we are using 'AUTH_tk65840af9f6f74d1aaefac978cb8f0899' as the X-Auth-Token. Replace this with the appropriate token you obtained in the above step.
To create a container:
curl -X PUT -H 'X-Auth-Token: AUTH_tk65840af9f6f74d1aaefac978cb8f0899' http://10.80.83.68:8077/v1/AUTH_system/mycontainer
To list all containers in current account:
@vishvananda
vishvananda / getpass.sh
Last active January 8, 2022 18:21
Script for setting an encrypted password on boot
#!/usr/bin/env bash
SSH_KEYFILE=`tempfile`
SSL_KEYFILE=`tempfile`
if ! curl -s -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > $SSH_KEYFILE; then
echo "Failed to get key"
fi
cat $SSH_KEYFILE
PASSWORD=`openssl rand -base64 48 | tr -d '/+' | cut -c1-16`
sudo usermod ubuntu -p `openssl passwd -1 $PASSWORD`
@reterVision
reterVision / notes.md
Last active March 30, 2023 11:51
Linux Performance Tuning

1.1 Linux process management

  • process scheduling
  • interrupt handling
  • signaling
  • process prioritization
  • process switching
  • process state
  • process memory
@hiroyuki-sato
hiroyuki-sato / roce-check.sh
Last active August 22, 2017 11:52
roce-check
#!/bin/bash
echo "============================"
echo " pfcrx / pfctx parameters "
echo "============================"
for i in /sys/module/mlx?_en ; do
m=$( basename $i )
echo "INTERFACE: $m"
RTX=$( cat $i/parameters/pfcrx )
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//