Skip to content

Instantly share code, notes, and snippets.

View scasella's full-sized avatar

Stephen Casella scasella

  • Washington, DC
View GitHub Profile
pragma solidity 0.4.19;
import { SafeMath } from "zeppelin-solidity/contracts/math/SafeMath.sol";
import { ERC20 } from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import { Exchange } from "../shared/Exchange.sol";
import { Proxy } from "../shared/Proxy.sol";
import { MathHelpers } from "../lib/MathHelpers.sol";
/**
* @title CoveredOption
@dabit3
dabit3 / basicmarket.sol
Last active January 9, 2024 08:54
Basic NFT marketplace
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract NFT is ERC721URIStorage {
using Counters for Counters.Counter;
@monikkinom
monikkinom / rnn-lstm.py
Last active September 3, 2019 04:44
Tensorflow RNN-LSTM implementation to count number of set bits in a binary string
#Source code with the blog post at http://monik.in/a-noobs-guide-to-implementing-rnn-lstm-using-tensorflow/
import numpy as np
import random
from random import shuffle
import tensorflow as tf
# from tensorflow.models.rnn import rnn_cell
# from tensorflow.models.rnn import rnn
NUM_EXAMPLES = 10000
@fchollet
fchollet / classifier_from_little_data_script_3.py
Last active September 13, 2023 03:34
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@yaycode
yaycode / 0 - instachat.md
Last active April 29, 2023 02:57
Elixir + Phoenix : Creating a simple chatroom

Instachat

The Phoenix Framework was built with realtime communication as a first class priority. Using its built in socket handling and channels we can implement a basic, realtime chat application with little effort.

For this video we’re going to assume that you already have Elixir and Phoenix Setup. You will not need a database as the messages will not be persisted. This tutorial is taken pretty much directly from the Phoenix Documentation.

Setting up the app

To start let’s generate a standard phoenix application:

$> mix phoenix.new instachat
@rajshah4
rajshah4 / RNN_Simple_Addition_Public.ipynb
Last active March 4, 2018 01:43
RNN_Addition_1stgrade
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hussius
hussius / ae_toy_example.py
Last active June 28, 2019 17:12
Toy example of single-layer autoencoder in TensorFlow
import tensorflow as tf
import numpy as np
import math
#import pandas as pd
#import sys
input = np.array([[2.0, 1.0, 1.0, 2.0],
[-2.0, 1.0, -1.0, 2.0],
[0.0, 1.0, 0.0, 2.0],
[0.0, -1.0, 0.0, -2.0],
@kscottz
kscottz / mp32np.py
Created July 1, 2013 04:29
Convert mp3 to numpy array. Ugly, but it works.
import os
import scipy.io.wavfile as wav
# install lame
# install bleeding edge scipy (needs new cython)
fname = 'XC135672-Red-winged\ Blackbird1301.mp3'
oname = 'temp.wav'
cmd = 'lame --decode {0} {1}'.format( fname,oname )
os.system(cmd)
data = wav.read(oname)
# your code goes here
@alexle
alexle / pythonsms.py
Last active December 1, 2023 01:01
How to send a text message with python
# sms.py
# Sends sms message to any cell phone using gmail smtp gateway
# Written by Alex Le
import smtplib
# Use sms gateway provided by mobile carrier:
# at&t: number@mms.att.net
# t-mobile: number@tmomail.net
# verizon: number@vtext.com
@defnull
defnull / gist:1224387
Created September 17, 2011 21:22
Deploy a Bottle app on Heroku
mkdir heroku
cd heroku/
virtualenv --no-site-packages env
source env/bin/activate
pip install bottle gevent
pip freeze > requirements.txt
cat >app.py <<EOF
import bottle
import os