Skip to content

Instantly share code, notes, and snippets.

View generic-github-user's full-sized avatar
📚
fervently skimming arXiv

Anna Allen generic-github-user

📚
fervently skimming arXiv
  • United States
View GitHub Profile
@tehZevo
tehZevo / tfjs-example.js
Last active September 15, 2018 19:06
An example solving XOR problem with tfjs
var tf = require("@tensorflow/tfjs");
//code modified from:
//https://medium.com/tensorflow/a-gentle-introduction-to-tensorflow-js-dba2e5257702
//define our inputs (combinations of 2 bits, represented as 0s and 1s)
//https://js.tensorflow.org/api/0.12.0/#tensor
var xs = tf.tensor([[0, 0], [0, 1], [1, 0], [1, 1]]);
//define our outputs (xor operation, a simple non-linear problem)
@fab1an
fab1an / enchantments.rb
Created March 11, 2012 16:48
Minecraft Enchantments simulator
DEBUG = false
ROUNDS = 100000
DUMP_FILE = "stats_enchantment.marshal"
# #
# #
# ##### DATA #
# #
# #
# Combos:
/*
Script: Color.js
Class for creating and manipulating colors in JavaScript. Includes basic color manipulations and HSB <-> RGB <-> HEX Conversions.
License:
MIT-style license.
*/
function Color(params){
var ptype = $type(params);
@dettmering
dettmering / gist:3767366
Created September 22, 2012 18:43
Python: Read CSV file into array
def readcsv(filename):
ifile = open(filename, "rU")
reader = csv.reader(ifile, delimiter=";")
rownum = 0
a = []
for row in reader:
a.append (row)
rownum += 1
@brunomonteiro3
brunomonteiro3 / random-number.js
Created May 10, 2017 01:34
Generate random number between two numbers in JavaScript
function randomIntFromInterval(min,max){
return Math.floor(Math.random()*(max-min+1)+min);
}
@vogonistic
vogonistic / repl_bot.js
Created January 25, 2013 04:15
REPL example bot for mineflayer. Allows testing javascript over CLI to speed up development.
// REPL example bot for mineflayer
//
// Connects to server but doesn't have any built in logic. The terminal where
// it was started is now a REPL (Read-Eval-Print-Loop). Anything typed will be
// interpreted as javascript printed using util.inspect. Don't forget to try
// tab completion. These variables are exposed as local:
//
// var mineflayer = require('mineflayer');
// var bot = mineflayer.createBot({ username: 'REPL' });
//
@AugustMiller
AugustMiller / map.js
Last active October 2, 2021 14:14
Map a number in one range to a number in another.
function mapNumber (number, inMin, inMax, outMin, outMax) {
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}
@n1ywb
n1ywb / retries.py
Created May 1, 2012 17:48
A Python function retrying decorator
#!/usr/bin/env python
#
# Copyright 2012 by Jeff Laughlin Consulting LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@dustinvtran
dustinvtran / tensorflow_api.csv
Created August 13, 2016 00:25
List of all TensorFlow operations
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 1 column, instead of 2. in line 4.
# TensorFlow r0.10
#
# Building Graph
#
add_to_collection,tf.add_to_collection
as_dtype,tf.as_dtype
bytes,tf.bytes
container,tf.container
control_dependencies,tf.control_dependencies
convert_to_tensor,tf.convert_to_tensor
@jesstelford
jesstelford / Links in markdown.md
Last active June 6, 2022 13:56
Putting links in code blocks on GitHub