Skip to content

Instantly share code, notes, and snippets.

View eldon's full-sized avatar

Eldon Schoop eldon

View GitHub Profile
@eldon
eldon / dont_autostart_globalprotect.sh
Created June 15, 2020 18:31
disable globalprotect autolaunch
#!/bin/sh
# # Script to disable GlobalProtect VPN from launching at logon in the LaunchAgents
# Thanks to David Schwartz: https://berkeley.service-now.com/kb_view.do?sysparm_article=KB0012481
defaults write /Library/LaunchAgents/com.paloaltonetworks.gp.pangpa.plist "RunAtLoad" -bool false
defaults write /Library/LaunchAgents/com.paloaltonetworks.gp.pangpa.plist "KeepAlive" -bool false
defaults write /Library/LaunchAgents/com.paloaltonetworks.gp.pangps.plist "RunAtLoad" -bool false
# exit 0
@eldon
eldon / dontdothis.py
Last active June 13, 2020 00:38
spicy_python_oneliners
# create a one-hot embedding for labels from (labels, examples) pairs
examples_labels = [[np.insert(np.zeros(4, dtype=np.int64), i, 1)] * e.shape[0] for i, e in enumerate(examples)]
# filter a list of words for words with numbers in them
df_word[np.vectorize(lambda x: any(map(str.isnumeric, x)))(df_word.word)]
# What's the index of the first nonconsecutive integer stored in a list of strings?
unique_numbers = df_numstrs[np.vectorize(lambda x: x.isnumeric())(df_numstrs.word.astype(int, errors='ignore'))].astype(int).drop_duplicates('word').sort_values('word')['word'].values
np.argmax(np.ediff1d(unique_numbers) > 1)
@eldon
eldon / install-deps.sh
Created June 25, 2019 18:23
Install ubuntu 18.04.2 with cuda-10.0, docker-ce, and friends
#!/bin/bash
# install cuda 10.0
sudo apt update
sudo apt install -y wget vim build-essential gcc
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.1.168-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo dpkg -i cuda-repo-ubuntu1804_10.1.168-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda-10.0
@eldon
eldon / setup_pix2pix.sh
Last active May 6, 2017 23:55
Set up azure data science vm for cyclegan and pix2pix
sudo chown $USER /data
sudo chgrp $USER /data
# create new conda environment using python3
conda create --yes --name cs280 python=3.5
source activate cs280
# -------
#export CMAKE_PREFIX_PATH=[anaconda root directory]
@eldon
eldon / get_bearer_token.py
Created February 28, 2017 04:46
Twitter Application-only authentication token retriever
import requests
CONSUMER_KEY = 'your key goes here'
CONSUMER_SECRET = 'your secret goes here'
r = requests.post('https://api.twitter.com/oauth2/token', auth=(CONSUMER_KEY, CONSUMER_SECRET), data={'grant_type': 'client_credentials'})
print r.json()
@eldon
eldon / CollatePages.js
Last active April 4, 2021 18:36
Mirroring the CollagePages script from here for future use: https://forums.adobe.com/thread/286654#
// Complements: Planet PDF (http://www.planetpdf.com/)
// Modified by Jeff Baitis for Acrobat 9 and Acrobat X compatibility
// Improved Collate function with status bar.
// Add a menu item to reverse all pages in the active document
app.addMenuItem({ cName: "Reverse", cParent: "Edit", cExec: "trustedReversePages();", cEnable: "event.rc = (event.target != null);", nPos: 0 });
// Add a menu item to collate with another document on the filesystem
app.addMenuItem({ cName: "Collate", cParent: "Edit", cExec: "trustedCollatePages();", cEnable: "event.rc = (event.target != null);", nPos: 0 });
trustedReversePages = app.trustedFunction(function()
@eldon
eldon / keybase.md
Created October 17, 2016 19:50
Identity

Keybase proof

I hereby claim:

  • I am eldon on github.
  • I am eldon (https://keybase.io/eldon) on keybase.
  • I have a public key whose fingerprint is 5F40 19CC 0CA9 E51A 98B9 E66D 3DC0 AADC FAA9 3BDA

To claim this, I am signing this object:

@eldon
eldon / mine_for_gold.py
Last active August 29, 2015 14:27
T-Prep 61A Bootcamp
def find_gold(mine):
"""
>>> find_gold([])
>>> find_gold(["coal"])
.
>>> find_gold(["gold"])
Yee haw! I'm rich!
>>> find_gold([[]])
Digging.
Going back.