Skip to content

Instantly share code, notes, and snippets.

View auser's full-sized avatar

Ari auser

View GitHub Profile
/**
* @param {number} x
* @return {number}
*/
var reverse = function(x) {
let y = 0;
let num = Math.abs(x);
const intMax = Math.pow(2, 31) + 1;
while(num != 0) {
// Not the fastest thing in the world
export default class Middleware {
constructor (methods) {
this.methods = methods;
this.methodsStack = {};
this.originalMethod = {};
methods.forEach (method => {
this.methodsStack[method] = [];
this.originalMethod[method] = this[method];
const splitTotal = (total, n) => {
let arr = [];
let i = 0;
while (i < n) {
arr.push(Math.floor(Math.random() * total) + 1)
i++;
}
const sorted = [0].concat(arr, [total]).sort((a, b) => a - b);
let out = [];
@auser
auser / web3-solc-contract-compile-deploy.js
Created March 2, 2018 20:18 — forked from tomconte/web3-solc-contract-compile-deploy.js
Compiling and deploying an Ethereum Smart Contract, using solc and web3.
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
// Connect to local Ethereum node
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
// Compile the source code
const input = fs.readFileSync('Token.sol');
const output = solc.compile(input.toString(), 1);
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
model = Sequential()
model.add(Dense(10, input_dim=X_train.shape[1], activation='sigmoid'))
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer=Adam(lr=0.01),
loss='binary_crossentropy',
@auser
auser / model.py
Last active April 16, 2020 18:08
def nn(X, y, hiddenLayerSize=10, learningRate=0.01, epochs=100, debug=False):
m = X.shape[1]
outputSize = y.shape[1]
# Make our model
model = dict(
w0 = np.random.randn(m, hiddenLayerSize),
w1 = np.random.randn(hiddenLayerSize, outputSize)
)
@auser
auser / data.py
Last active April 16, 2020 18:09
import numpy as np
import pandas as pd
np.random.seed(1)
# train comes from the titantic dataset provided by
# kaggle (https://www.kaggle.com/c/titanic/data)
df = pd.read_csv('./data/titanic-train.csv')
def preprocess(raw_data):
# Preprocess data
Verifying my Blockstack ID is secured with the address 14xYsyu9E2KocyoSUpByuJ6qZ7RSy3WcAv https://explorer.blockstack.org/address/14xYsyu9E2KocyoSUpByuJ6qZ7RSy3WcAv
module.exports = function container_plugin(md, name, options) {
function validateDefault(params) {
return true;
// return params.trim().split(' ', 2)[0] === name;
}
function renderDefault(tokens, idx, _options, env, self) {
// add a class to the opening tag
if (tokens[idx].nesting === 1) {
tokens[idx].attrPush(['class', `${name} ignore-me`]);
@auser
auser / timeline.css
Last active December 30, 2022 05:14
.demo {
position: relative;
}
.demo .notificationsFrame {
z-index: 2;
width: 100%;
top: 20px;
background: #fff;
border-radius: 3px;
overflow: hidden;