Skip to content

Instantly share code, notes, and snippets.

View benhg's full-sized avatar
🚄

Ben Glick benhg

🚄
View GitHub Profile
server {
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name HOST;
error_page 404 /custom_404.html;
location / {
try_files $uri $uri/ =404;
}
@benhg
benhg / db.sh
Created August 15, 2019 16:15
docker build with $1 as tag
db()
{
docker build -t $1 .
}
function download(filename, text) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
@benhg
benhg / blt-parsl-base.py
Created June 12, 2019 00:37
all of the base stuff to do a Parsl dataflow on blt
import parsl
from parsl.app.app import python_app, bash_app
from parsl.config import Config
from parsl.executors import IPyParallelExecutor
from parsl.providers import GridEngineProvider
from parsl.executors import HighThroughputExecutor
config = Config(
executors=[HighThroughputExecutor(provider=GridEngineProvider(), label="Grid Engine Provider")],
)
USER='username'
PASS='passwd'
sudo useradd -m -d /home/$USER --password $(echo "$PASS" | openssl passwd -1 -stdin ) $USER
# omit 1,2 if env variables are otherwise set.
@benhg
benhg / watch qstat
Last active May 29, 2019 23:21
"watch -n 1 qstat" doesn't page right. Do this instead
while qstat; do sleep 1; done
@benhg
benhg / remove_non_ascii.sh
Created March 25, 2019 17:49
Remove all non ascii characters with a little perl inline
perl -pi -e 's/[^[:ascii:]]//g' *.txt
@benhg
benhg / install_toggle_umikaze.sh
Created March 19, 2019 20:28
Install toggle to umikaze
i need to finish this later
@benhg
benhg / poembot-formatter.py
Created March 11, 2019 03:11
Formats text poems for poembot. Ensures that there are only 32 characters per line. Breaks up on whole words only.
strin = " ".join(open(input("Poem File?\n") + ".txt", "r").readlines())
def split_string(str, limit, sep=" "):
words = str.split()
if max(map(len, words)) > limit:
raise ValueError("limit is too small")
res, part, others = [], words[0], words[1:]
for word in others:
if len(sep) + len(word) > limit - len(part):
@benhg
benhg / setup.md
Created June 26, 2018 15:53 — forked from developius/README.md
Set up GitHub push with SSH keys

Create a repo. Make sure there is at least one file in it (even just the README) Generate ssh key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings. Test SSH key:

ssh -T git@github.com