A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
# gem install httparty | |
# ruby gists.rb | |
require 'httparty' | |
class Gists | |
include HTTParty | |
@username = 'x' | |
@password = 'x' |
# toggle iTerm Dock icon | |
# add this to your .bash_profile or .zshrc | |
function toggleiTerm() { | |
pb='/usr/libexec/PlistBuddy' | |
iTerm='/Applications/iTerm.app/Contents/Info.plist' | |
echo "Do you wish to hide iTerm in Dock?" | |
select ync in "Hide" "Show" "Cancel"; do | |
case $ync in | |
'Hide' ) |
import sys; from PIL import Image; import numpy as np | |
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@')) | |
if len(sys.argv) != 4: print( 'Usage: ./asciinator.py image scale factor' ); sys.exit() | |
f, SC, GCF, WCF = sys.argv[1], float(sys.argv[2]), float(sys.argv[3]), 7/4 | |
img = Image.open(f) | |
S = ( round(img.size[0]*SC*WCF), round(img.size[1]*SC) ) | |
img = np.sum( np.asarray( img.resize(S) ), axis=2) |
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.
This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.
You are encouraged to fork this and modify it to your heart's content to match your own needs.
#!/usr/bin/env bash | |
# Create a page in the current dir | |
echo "My Test Page" > test.html | |
# Start server | |
python -m SimpleHTTPServer 8000 &> /dev/null & | |
pid=$! | |
# Give server time to start up |
The most important part of Jupyter for our purposes is the Notebook, a tool for developing and documenting code across a variety of languages. Take a moment and check out a gallery of fantastic notebooks to get an idea of what it is used for.
All users can install Jupyter according to the installation instructions in the Jupyter documentation. I will refer to this as the "Anaconda method" because that is the package manager recommended in the official documentation. This should work smoothly, especially if you primarily intend to use Python in Jupyter.
However, for Mac users, I would recommend an alternative installation method (the "Homebrew method") that should make it easier to support alternative languages.
import java.awt.Point; | |
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.util.HashSet; | |
import java.util.Set; | |
public class Day3 { | |
public static void main(String[] args) { |
/* | |
Automatically click all "Verify your email" links in the welcome e-mail from | |
Nintendo Pokémon Trainer Club's signup e-mails. | |
Only unread emails in inbox will be processed. | |
All processed e-mails will be marked as read if verification was successful, | |
and optionally moved to trash if it's enabled in your settings. | |
How to use: | |
1. Login to Gmail |
# ======================================================== | |
# Setup a Dumb AP, Wired backbone for OpenWRT / LEDE | |
# ======================================================== | |
# Set lan logical interface as bridge (to allow bridge multiple physical interfaces) | |
uci set network.lan.type='bridge' | |
# assign WAN physical interface to LAN (will be available as an additional LAN port now) | |
uci set network.lan.ifname="$(uci get network.lan.ifname) $(uci get network.wan.ifname)" | |
uci del network.wan.ifname | |
# Remove wan logical interface, since we will not need it. | |
uci del network.wan |