Skip to content

Instantly share code, notes, and snippets.

View khodges42's full-sized avatar
💭
on that anime profile picture on github type energy

K. Hodges khodges42

💭
on that anime profile picture on github type energy
  • LA
View GitHub Profile
from keras.models import Sequential
from keras.layers import Dense
x, y = ...
x_val, y_val = ...
# 1-dimensional MSE linear regression in Keras
model = Sequential()
model.add(Dense(1, input_dim=x.shape[1]))
model.compile(optimizer='rmsprop', loss='mse')
@nod
nod / minimal_ansible_playbook.py
Last active April 25, 2024 20:18
Minimal code to run an Ansible Playbook from within python and get stats back on success or fail
from ansible import playbook, callbacks
# uncomment the following to enable silent running on the playbook call
# this monkey-patches the display method on the callbacks module
# callbacks.display = lambda *a,**ka: None
# the meat of the meal. run a playbook on a path with a hosts file and ssh key
def run_playbook(playbook_path, hosts_path, key_file):
stats = callbacks.AggregateStats()
playbook_cb = callbacks.PlaybookCallbacks(verbose=0)
@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@un33k
un33k / sed cheatsheet
Created August 22, 2011 13:28
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'