Skip to content

Instantly share code, notes, and snippets.

View jonathanmarvens's full-sized avatar

Jonathan Barronville jonathanmarvens

View GitHub Profile
@jonathanmarvens
jonathanmarvens / langoliers.rb
Last active August 29, 2015 14:26 — forked from robinsloan/langoliers.rb
Tweet delete script
#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'
require 'json'
require 'faraday'
# things you must configure
PATH_TO_DROPBOX = "/Users/your_name/Dropbox/backup/tweets/" # you need to create this folder
TWITTER_USER = "your_twitter_username"
@jonathanmarvens
jonathanmarvens / Makefile
Last active August 29, 2015 14:21 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
require 'eventmachine'
EM.run do
SEKRET_SAUCE = EM.attach(
open(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null', 'w')
)
EM.start_server('0.0.0.0', 80, Module.new do
def post_init; proxy_incoming_to(SEKRET_SAUCE); end
end)
end
class BasicPerceptron
def initialize(weights, bias)
@weights = weights
@threshold = bias * -1
end
def run(inputs)
input_weight_pairs = inputs.zip @weights
sum = 0.0
input_weight_pairs.each { |input, weight| sum += input * weight }
function BasicPerceptron(weights, bias) {
this.weights = weights;
this.threshold = bias * -1;
}
BasicPerceptron.prototype.run = function run(inputs) {
var sum = 0.0;
for (var a = 0; a < inputs.length; a++) {
sum += inputs[a] * this.weights[a];
}
class BasicPerceptron(object):
def __init__(self, weights, bias):
self.weights = weights
self.threshold = bias * -1
def run(self, inputs):
input_weight_pairs = zip(inputs, self.weights)
sum_ = 0.0
for input_, weight in input_weight_pairs:
sum_ += input_ * weight
return 0 if sum_ <= self.threshold else 1

Keybase proof

I hereby claim:

  • I am jonathanmarvens on github.
  • I am jonathanmarvens (https://keybase.io/jonathanmarvens) on keybase.
  • I have a public key whose fingerprint is 98D1 82B1 5CD2 501F 1DB2 E271 20A8 6ECF 5BD6 3FF1

To claim this, I am signing this object:

@jonathanmarvens
jonathanmarvens / full-names.txt
Last active October 29, 2023 17:43
US states list.
Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
#define AP_HASH(h, s, l) \
do { \
h = 0xAAAAAAAAu; \
unsigned int i = 0u; \
while (i < l) { \
if ((i & 1u) == 0u) { \
h ^= (h << 7) ^ (((unsigned char) s[0]) * (h >> 3)); \
} else { \
h ^= ~((h << 11) + (((unsigned char) s[0]) ^ (h >> 5))); \
} \