Skip to content

Instantly share code, notes, and snippets.

@wjladams
wjladams / script.sh
Created October 12, 2018 17:17
Updating anaconda
#!/bin/sh
conda update -n root conda
conda update --all
# Borrowed from https://stackoverflow.com/questions/45197777/how-do-i-update-anaconda
@wjladams
wjladams / fixscroll.sh
Created April 9, 2018 21:03
xubuntu reverse scrolling
#!/bin/sh
# Find the amount by doign
# synclient | grep HorizScrollDelta
# synclient | grep VertScrollDelta
# And then simply negative that value for this
# Found at
# https://askubuntu.com/questions/690512/how-to-enable-natural-scrolling-in-xfce4/853262
# This is because, although xubuntu 18.04 has reverse scrolling option in touchpad
# settings, it doesn't really work, the setting does not cascade to gnome apps for some reason.
synclient HorizScrollDelta=-116
@wjladams
wjladams / pypi-module-creating.md
Last active April 22, 2018 15:36
Creating a pip installable python module from source using pypi

Creating / Uploading pypi python module

  1. Install twine and make sure tools are up to date by running

    pip install -U pip setuptools twine
    
  2. Create an account at https://pypi.org/ and also https://test.pypi.org/, the latter for testing.

  3. Follow the instructions at Packaging and distributing project for informationa about setup.cfg and setup.py usage

  4. From the package directory run the following (assuming you want to distribute a source distribution and a wheel for the particular python you are using. A wheel distribution is essentially a packaged version that is operating system agnostic but is either python2 or python3 specific):

@wjladams
wjladams / gist:9a4eaa9c845bf5831e88c56ddede1829
Created March 24, 2018 05:30
matplotlib scatter with size
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams["figure.figsize"] = (12,7)
xs = [1,2,3]
ys = [2, 3, 8]
plt.scatter(xs, ys)
# or
plt.plot(xs, ys)
@wjladams
wjladams / pom.xml
Created February 26, 2018 19:20
maven pom specifying java version easily using properties
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
@wjladams
wjladams / com.bill.jupyter.plist
Last active November 22, 2022 18:13
Jupyter on mac run as a launchd service
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.bill.jupyter</string>
<key>ProgramArguments</key>
@wjladams
wjladams / gist:aa366fdd0f0bb217011bfe688c88c53a
Created December 22, 2017 13:31
installing gspread_dataframe from my pull request
pip install https://github.com/dlmaths/gspread-dataframe/archive/create-open-change.zip
@wjladams
wjladams / scatter.py
Created December 4, 2017 19:42
plotly scatterplot example
#Import and initialize notebook mode. Generally run from Jupyter
from plotly.offline import plot, iplot, init_notebook_mode
from plotly.graph_objs import Scatter, Layout
init_notebook_mode()
#Data
xs = [1, 2, 3, 4, 5, 6, 7, 8, 9]
ys = [1, 1.5, 3, 4, 5, 5.5, 5.9, 6.05, 6.1]
#Plot
iplot([Scatter(x=xs, y=ys)])
@wjladams
wjladams / gist:d89fc5838574774b92095af15924aaab
Created December 4, 2017 15:50
install pyanp from github using pip
pip install git+https://github.com/wjladams/pyanp.git