Skip to content

Instantly share code, notes, and snippets.

View tannerdsilva's full-sized avatar
🎯
Focusing

Tanner Silva tannerdsilva

🎯
Focusing
View GitHub Profile
@serhii-londar
serhii-londar / swift_4_1_ubuntu16_04.sh
Last active November 26, 2018 08:15
Install swift 4.1 on Ubuntu 16.04 bash script
#!/bin/bash
sudo apt-get install clang libicu-dev libcurl4-openssl-dev lldb git wget unzip -y
wget https://swift.org/builds/swift-4.1-release/ubuntu1604/swift-4.1-RELEASE/swift-4.1-RELEASE-ubuntu16.04.tar.gz
tar zxf swift-4.1*.tar.gz && rm -rf swift-4.1*.tar.gz
sudo mv swift-4.1* /swift-4.1
echo "export PATH=/swift-4.1/usr/bin:\"\${PATH}\"" >> ~/.bashrc
source ~/.bashrc
@tr3buchet
tr3buchet / debootstrap.md
Last active July 5, 2023 11:26
debian usb debootstrap

make sure any needed utilities are installed

sudo aptitude install debootstrap coreutils util-linux e2fsprogs

get usb device

df -h
@jboner
jboner / latency.txt
Last active May 25, 2024 17:11
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
@fduran
fduran / gist:1870429
Created February 20, 2012 18:15
Linux disk space email alert
#!/bin/bash
# www.fduran.com
# script that will send an email to EMAIL when disk use in partition PART is bigger than %MAX
# adapt these 3 parameters to your case
MAX=95
EMAIL=alert@example.com
PART=sda1
USE=`df -h |grep $PART | awk '{ print $5 }' | cut -d'%' -f1`
if [ $USE -gt $MAX ]; then
@glacjay
glacjay / tun-ping-linux.py
Created September 18, 2010 04:49
Reading/writing Linux's TUN/TAP device using Python.
import fcntl
import os
import struct
import subprocess
# Some constants used to ioctl the device file. I got them by a simple C
# program.
TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2
// a) As Mac OS X does not have byteswap.h
// needed this for a c util I had used over the years on linux.
// did not find a solution to stopgap via macports, sadly, but this did the trick
#if HAVE_BYTESWAP_H
#include <byteswap.h>
#else
#define bswap_16(value) \
((((value) & 0xff) << 8) | ((value) >> 8))