Skip to content

Instantly share code, notes, and snippets.

View KristobalJunta's full-sized avatar
🇺🇦

Eugene KristobalJunta

🇺🇦
View GitHub Profile
@craffel
craffel / draw_neural_net.py
Created January 10, 2015 04:59
Draw a neural network diagram with matplotlib!
import matplotlib.pyplot as plt
def draw_neural_net(ax, left, right, bottom, top, layer_sizes):
'''
Draw a neural network cartoon using matplotilb.
:usage:
>>> fig = plt.figure(figsize=(12, 12))
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2])
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 16, 2024 12:40
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active May 1, 2024 23:17
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@robwilkerson
robwilkerson / install-db.sh
Created June 25, 2013 16:24
Creates and populates a local (Vagrant) database from a remote production source database.
echo "--> Creating a fresh database..."
mysql -uroot --execute "DROP DATABASE IF EXISTS <db_name>; CREATE DATABASE <db_name> CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
echo "<-- Complete."
echo "--> Configuring SSH access to production resources for `id -un`..."
mkdir ~/.ssh
cp /vagrant/.ssh/<name>.pem ~/.ssh
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
SSH_OPTIONS=''
@jpatters
jpatters / HeidiDecode.js
Last active May 17, 2024 12:41
Decodes a password from HeidiSQL. HeidiSQL passwords can be found in the registry. Use File -> Export Settings to dump all settings. Great for if you forget a password.
function heidiDecode(hex) {
var str = '';
var shift = parseInt(hex.substr(-1));
hex = hex.substr(0, hex.length - 1);
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift);
return str;
}
document.write(heidiDecode('755A5A585C3D8141786B3C385E3A393'));
@sheilatron
sheilatron / python_popen_python.py
Created March 21, 2012 14:13
Python function to create child Python processes inheriting sys.paths
def spawn_python_script(package_name, script_name, *args):
"""
Run the module ``script_name`` as an external Python script,
using the same Python executable as the current process,
with the same Python paths. This needs to support both
virtualenv and buildout Python executables.
Example:
popen = run_as_script('zetl.scripts','start_conductor.py')
@realmyst
realmyst / gist:1262561
Created October 4, 2011 19:34
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE