This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# ~/.ssh/gcp-start-iap-tunnel-ssh-proxy-magic.sh | |
# a script to be used as SSH ProxyCommand to allow fully functional SSH access to any Google Cloud Compute Engine VMs allowing IAP access | |
# | |
# Author: Jaeho Shin <netj@sparcs.org> | |
# Created: 2022-10-31 | |
# See also: | |
# - https://gist.github.com/netj/df4f9de1fefd254ab11979be7035b5d0/#readme | |
# - https://cloud.google.com/iap/docs/using-tcp-forwarding | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this shell script can make a large swap quickly and put it on | |
set -x | |
set -e | |
if [ "$(id -u)" != 0 ]; then | |
echo "This script must be run with sudo." | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.cs.cmu.edu/afs/cs.cmu.edu/project/fgdata/OldFiles/Recorder.app/utterances/Type1/harvsents.txt | |
# taken from here ^ and pythonified | |
h1 = [ | |
"The birch canoe slid on the smooth planks.", | |
"Glue the sheet to the dark blue background.", | |
"It's easy to tell the depth of a well.", | |
"These days a chicken leg is a rare dish.", | |
"Rice is often served in round bowls.", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NEW_USER=$1 | |
set -e | |
if [ -z "$NEW_USER" ];then | |
echo "Please provide user as arg... exiting." | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | |
# You would have to create an xorg.conf file for your Nvidia setup # | |
# before using this script! It can be done by running: # | |
# # | |
# nvidia-xconfig -o /etc/X11/xorg.conf.nvidia # | |
# # | |
# Make sure your system has eGPU connected and a monitor plugged into the GPU. # | |
# The reason I've never automated this is that you have to have it all plugged # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=GPU Switcher | |
After=systemd-user-sessions.service plymouth-quit.service | |
Before=display-manager.service | |
[Service] | |
ExecStart=/usr/local/bin/autogpuswitch.sh | |
Restart=no | |
Type=oneshot | |
RemainAfterExit=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import numpy as np | |
import keras | |
import tensorflow as tf | |
from keras.applications import ResNet50 | |
from keras.preprocessing import image as image_utils | |
from keras.applications.resnet50 import preprocess_input, decode_predictions | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers | |
-------------------------- | |
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 |