Skip to content

Instantly share code, notes, and snippets.

Avatar
🔷

Santiago Palladino spalladino

🔷
View GitHub Profile
View AdminUpgradeabilityProxy.abi.json
[
{
"inputs": [
{
"name": "_implementation",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
@spalladino
spalladino / count-repos.py
Last active Feb 21, 2020
Estimate number of repositories that match a code search
View count-repos.py
from http.client import HTTPSConnection
from base64 import b64encode
from json import loads
from sys import exit, argv, stderr
from time import sleep
import urllib3
# Settings
PRINT_REPOS = True
@spalladino
spalladino / hash.py
Created Oct 21, 2017
Solution for Coursera Cryptography 1 course Week 3 programming assignment
View hash.py
from hashlib import sha256
from sys import argv
with open(argv[1], "rb") as f:
blocks = []
block = f.read(1024)
while block:
blocks.append(block)
block = f.read(1024)
@spalladino
spalladino / web3.js
Created Oct 16, 2017
Detect whether a web3 connection is available
View web3.js
// Adapted from https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#partly_sunny-web3---ethereum-browser-environment-check
window.addEventListener('load', function() {
// Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof web3 !== 'undefined') {
// Use Mist/MetaMask's provider
window.web3 = new Web3(web3.currentProvider);
} else {
// fallback - use your fallback strategy (local node / hosted node + in-dapp id mgmt / fail)
window.web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
@spalladino
spalladino / monitor.js
Created Oct 15, 2017
Configure ngrok with nodemon for local development
View monitor.js
#!/usr/bin/env node
if (process.env.NODE_ENV === 'production') {
throw new Error("Do not use nodemon in production, run bin/www.js directly instead");
}
const nodemon = require('nodemon');
const ngrok = require('ngrok');
// We start an ngrok tunnel to ensure it stays the same for the entire process
@spalladino
spalladino / rinkeby.txt
Created Sep 8, 2017
Rinkeby test address
View rinkeby.txt
0x9D49a5aBBD1AD73aA7D0547e3Ec5B14ce640718E
@spalladino
spalladino / main.cr
Last active Nov 29, 2016
Alternative code for "Crystal in real life" post
View main.cr
# Adapted from http://pfertyk.me/2016/11/crystal-in-real-life/
require "stumpy_png"
canvas = StumpyPNG.read("image.png")
canvas.width.times do |x|
canvas.height.times do |y|
color = canvas[x, y]
@spalladino
spalladino / Makefile
Created Nov 23, 2016
Proof of concept of Ruby extension written in Crystal
View Makefile
testruby.bundle: testruby.cr
crystal testruby.cr --link-flags "-dynamic -bundle -Wl,-undefined,dynamic_lookup" -o testruby.bundle
irb: testruby.bundle
irb -rtestruby -I.
clean:
rm -rf .crystal testruby.bundle
View sample_manifest.xml
<?xml version="1.0" encoding="UTF-8" ?>
<verboice-service>
<name>Callback test</name>
<steps>
<step name="callback-test"
display-name="Callback test"
icon="medicalkit"
type="callback"
callback-url="http://requestb.in/y9fz04y9">
<settings>
@spalladino
spalladino / send_aos.rb
Created Apr 21, 2016
Sends AOs in bulk to Nuntium
View send_aos.rb
require "rubygems"
require "nuntium"
SERVER = ""
ACCOUNT = ""
APPLICATION = ""
PASSWORD = ""
COUNT = 1000
FROM = ""
You can’t perform that action at this time.