Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
import torch | |
from torch.nn.functional import conv2d | |
def pointwise(X, W): | |
n,c_in,h,w = X.size() # (n examples, c_in channels, height, width) | |
c_out,c_in,_,_ = W.size() # (c_out channels, c_in channels, 1, 1) | |
W = W.view(c_out,c_in) # squeeze size 1 dims, shape=(c_out, c_in) | |
X = X.view(n,c_in,h*w) # flatten spatial dims | |
X = X.permute(0,2,1) # transpose, shape=(n,h*w, c_in) | |
K = X.reshape(n*h*w,c_in) # kernel matrix, shape=(n*h*w, c_in) |
This file contains hidden or 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
# for making lockscreen images | |
set-i3lock-bg() { | |
if [ ! -f ~/lock.png ]; then | |
curl https://raw.githubusercontent.com/meskarune/i3lock-fancy/master/icons/lock.png > ~/lock.png | |
fi | |
SIZE=`xdpyinfo | grep dimensions | cut -d " " -f 7` | |
convert $1 -font Liberation-Sans \ | |
-geometry $SIZE -gravity center\ | |
-pointsize 26 -fill white -extent $SIZE -gravity center \ | |
-annotate +0+160 "Type Password to Unlock" ~/lock.png \ |
This file contains hidden or 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 | |
ALGO_IP=`ip addr | awk ' | |
/^[0-9]+:/ { | |
sub(/:/,"",$2); iface=$2 } | |
/^[[:space:]]*inet / { | |
split($2, a, "/") | |
print iface" : "a[1] | |
}' | grep tun | cut -b 8- | cut -d "." -f 1-3 | sed 's/$/.1/'` | |
mosh --ssh="ssh -i algo.pem" ubuntu@$ALGO_IP |
This file contains hidden or 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
sudo apt-get update && sudo apt-get install \ | |
build-essential \ | |
libssl-dev \ | |
libffi-dev \ | |
python-dev \ | |
python-pip \ | |
python-setuptools \ | |
python-virtualenv -y | |
sudo pip2 install -r requirements.txt |
This file contains hidden or 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
! 6/23/2019 https://twitter.com | |
twitter.com##.trends.Trends.module | |
twitter.com##.r-1adg3ll.css-1dbjc4n > .css-1dbjc4n > .r-1sp51qo.r-1wtj0ep.r-qklmqi.r-rull8r.r-my5ep6.css-1dbjc4n | |
twitter.com##div.r-1adg3ll.r-qklmqi.r-my5ep6.css-1dbjc4n:nth-of-type(2) > .r-6416eg.r-o7ynqc.r-1w50u8q.r-utggzx.r-6koalj.r-1loqt21.css-1dbjc4n | |
twitter.com##.r-1l5qxre.css-1dbjc4n | |
! 6/24/2019 https://twitter.com | |
twitter.com##div.r-1adg3ll.r-qklmqi.r-my5ep6.css-1dbjc4n:nth-of-type(3) > .r-6416eg.r-o7ynqc.r-1xtiow5.r-5f36wq.r-6koalj.r-1loqt21.css-1dbjc4n | |
twitter.com##div.r-1adg3ll.r-qklmqi.r-my5ep6.css-1dbjc4n:nth-of-type(4) > .r-6416eg.r-o7ynqc.r-1xtiow5.r-5f36wq.r-6koalj.r-1loqt21.css-1dbjc4n | |
twitter.com##div.r-1adg3ll.r-qklmqi.r-my5ep6.css-1dbjc4n:nth-of-type(5) > .r-6416eg.r-o7ynqc.r-1xtiow5.r-5f36wq.r-6koalj.r-1loqt21.css-1dbjc4n |
So, you want to be able to work from anywhere. You want to be on a mountain somewhere, two bars of 3G signal, and you forward that to your laptop with a WiFi hotspot. Open your laptop and your shell on remote is already open and as responsive as possible. Work/life balance? With power like this, who cares?
Often, in academic institutions at least, you have the following situation:
This file contains hidden or 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
import os | |
import boto3 | |
if __name__ == '__main__': | |
session = boto3.Session() | |
ec2 = session.resource('ec2') | |
ec2c = session.client('ec2') | |
# add active instances to the user's ssh config file | |
instances = ec2.instances.filter( | |
Filters=[{'Name': 'instance-state-name', 'Values': ['running']}]) |