sudo aptitude install debootstrap coreutils util-linux e2fsprogs
df -h
| #!/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 |
| 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 |
| #!/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 protected] | |
| PART=sda1 | |
| USE=`df -h |grep $PART | awk '{ print $5 }' | cut -d'%' -f1` | |
| if [ $USE -gt $MAX ]; then |
| 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)) | |