Skip to content

Instantly share code, notes, and snippets.

View danielsamuels's full-sized avatar

Daniel Finch danielsamuels

View GitHub Profile
@danielsamuels
danielsamuels / style.css
Created April 29, 2020 15:39
Dark mode stylesheet for docs.python.org
html,
body,
div.document,
div.body,
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6,
eyJtb25leSI6IjIuMzEzMDUxOTI3ODc2MzYyZSsxMjcyMCIsInRpY2tTcGVlZENvc3QiOiIxLjUxOTQ0MTUwMDUwMDYwNTdlKzUwNjYiLCJ0aWNrc3BlZWQiOiI1Ljg2MDIwMDYzNjE5NzQ4MWUtNzg3IiwiZmlyc3RDb3N0IjoiOS4zOTk3OTM3OTQ4OTI2MTNlKzUwOTQiLCJmaXJzdEFtb3VudCI6IjguMTIyMzAyOTM2MjcyMTM4ZSsxMTAxNCIsImZpcnN0Qm91Z2h0IjoyMzgwLCJmaXJzdFBvdyI6IjMuMDMzOTMzMjMzNzQ5MTIwM2UrMTI5Iiwic2Vjb25kQ29zdCI6IjQuMjQxMzE3NzE5Mzk3MjJlKzUwOTMiLCJzZWNvbmRBbW91bnQiOiIxLjk4NDc5MjA2OTA1NDM5NDNlKzk0NDEiLCJzZWNvbmRCb3VnaHQiOjIxMDAsInNlY29uZFBvdyI6IjIuMzcyNjQzNDYyNjM4NDYxNGUrMTE5IiwidGhpcmRDb3N0IjoiMS41NTAxMzA2NTk4MjIzNDEyZSs1MDg5IiwidGhpcmRBbW91bnQiOiI0LjQ5MzY3NDIyMDgzMTY0MDVlKzc4NzQiLCJ0aGlyZEJvdWdodCI6MTkyMCwidGhpcmRQb3ciOiI1LjQ0Mzc2NjUxNzQ0MjQ2N2UrMTEyIiwiZm91cnRoQ29zdCI6IjQuNTg5MDI5MjM0MzM3NDM1ZSs1MDg2IiwiZm91cnRoQW1vdW50IjoiNi4xNjQ0NDk5MjQyNzMxNTI1ZSs2MzEyIiwiZm91cnRoQm91Z2h0IjoxODAwLCJmb3VydGhQb3ciOiIxLjUwMzI0ODY2MjY2NzcyMDRlKzEwOCIsImZpZnRoQ29zdCI6IjIuMTM3Mzc1OTQ1MDM0NjQ1N2UrNTA3MCIsImZpZnRoQW1vdW50IjoiNC4yODM0ODQ2Mzc3OTE4NzZlKzQ3NTciLCJmaWZ0aEJvdWdodCI6MTYzMCwiZmlmdGhQ
Mon Oct 07 11:41:18 ~/Workspace/playground/baconbot-cnn-js (master)
$ python -m venv .venv
$ . .venv/Scripts/activate
(.venv) Mon Oct 07 11:43:12 ~/Workspace/playground/baconbot-cnn-js (master)
$ which pip
/c/Users/daniel.samuels/Workspace/playground/baconbot-cnn-js/\Users\daniel.samuels\Workspace\playground\baconbot-cnn-js\.venv/Scripts/pip
(.venv) Mon Oct 07 11:43:16 ~/Workspace/playground/baconbot-cnn-js (master)
$ pip install tensorflowjs
Collecting tensorflowjs
Downloading https://files.pythonhosted.org/packages/cf/33/cc0c2caf6e1dc07858b42e268a3f18c525263aad2be8dba6a8ee02b4e8bb/tensorflowjs-1.2.10.1-py3-none-any.whl (47kB)
Epoch 1/15
21/21 - 158s - loss: 0.5255 - acc: 0.8096 - val_loss: 0.5186 - val_acc: 0.8427
Epoch 2/15
21/21 - 119s - loss: 0.4556 - acc: 0.8428 - val_loss: 0.4863 - val_acc: 0.8427
Epoch 3/15
21/21 - 118s - loss: 0.4196 - acc: 0.8424 - val_loss: 0.3253 - val_acc: 0.8541
Epoch 4/15
21/21 - 117s - loss: 0.3708 - acc: 0.8277 - val_loss: 0.2493 - val_acc: 0.9279
Epoch 5/15
21/21 - 117s - loss: 0.3662 - acc: 0.8854 - val_loss: 0.2062 - val_acc: 0.9262
@danielsamuels
danielsamuels / .bashrc
Created February 12, 2019 11:05
BMS shell scripts (works with Python 2 and 3!)
alias gsu="git submodule update"
bms() {
source ~/.pythonversion
if [[ $PYTHONVERSION -eq 2 ]]; then
winpty python2/python.exe python2/Scripts/bms-script.py
else
winpty python3/python.exe python3/Scripts/bms-script.py
fi
@danielsamuels
danielsamuels / sshd_github_keys.sh
Created November 15, 2017 17:22
SSH authentication using a Github organisation as a source
#!/usr/bin/env python3
import json
from urllib.request import urlopen
def main():
with urlopen('https://api.github.com/orgs/onespacemedia/public_members') as f:
users = json.loads(f.read().decode('utf8'))
for user in users:
@danielsamuels
danielsamuels / gist.sh
Last active October 4, 2017 11:58
Create Python virtual environments
venv() {
PYTHON_2_COMMAND="/usr/local/bin/virtualenv -p python .venv"
PYTHON_3_COMMAND="/usr/local/bin/python3 -m venv .venv"
# Was the Python version defined in the args?
if [ -z "$1" ]; then
# Try to read the Django version from the requirements
DJANGO_VERSION=(`grep '^Django' requirements.txt | python -c 'import sys; req = sys.stdin.read().strip(); print(req.split(".")[1])'`)
if (( DJANGO_VERSION > 10 )); then
@danielsamuels
danielsamuels / settings.json
Last active November 13, 2017 14:01
VSCode settings
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.fontSize": 14,
"editor.insertSpaces": true,
"editor.renderWhitespace": "none",
"search.exclude": {
"**/.git": true,
"**/.svn": true,
@danielsamuels
danielsamuels / SearchAllTables.sql
Created June 9, 2017 09:42
MSSQL search all tables
CREATE PROC SearchAllTables
(
@SearchStr nvarchar(100)
)
AS
BEGIN
-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
-- Purpose: To search all columns of all tables for a given search string
-- Written by: Narayana Vyas Kondreddi
@danielsamuels
danielsamuels / user-settings.json
Last active May 16, 2017 15:35
VSCode Settings
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Inconsolata",
"editor.fontSize": 16,
"editor.insertSpaces": true,
"editor.renderWhitespace": false,
"search.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,