Skip to content

Instantly share code, notes, and snippets.

View shayanb's full-sized avatar
💭
\-=-=|=-=-/

Shayan Eskandari shayanb

💭
\-=-=|=-=-/
View GitHub Profile
@shayanb
shayanb / check-eslint.sh
Created July 12, 2018 17:31
Bash script to check for affected ESLint compromised ([email protected])
#!/bin/bash
# Checks all directories in cwd for compromised eslint version
cwd=$PWD
for d in `find . -maxdepth 1 -type d`; do
cd $d
version=$(npm ls 2> /dev/null | grep eslint@ | sed -e 's/.*eslint@\([0-9.]*\).*/\1/')
if [ -n "$version" ]; then
for v in $version; do
echo "$d -> eslint@$v"
if [ "$v" = '3.7.2' ]; then
@shayanb
shayanb / helloWorld.sol
Last active October 12, 2017 00:06
Hello World Solidity Sample - EthWaterloo
pragma solidity ^0.4.12;
contract helloworld {
address private Owner;
string public sayHello;
function helloworld() {
Owner = msg.sender;
sayHello = "Hello";
0xc2285f89B5b228E9a51f2B80dd0712F0ac071C9e
@shayanb
shayanb / README.md
Created March 28, 2017 22:02 — forked from hubgit/README.md
Remove metadata from a PDF file, using exiftool and qpdf. Note that embedded objects may still contain metadata.

Anonymising PDFs

PDF metadata

Metadata in PDF files can be stored in at least two places:

  • the Info Dictionary, a limited set of key/value pairs
  • XMP packets, which contain RDF statements expressed as XML

PDF files

@shayanb
shayanb / eventListener.js
Created September 15, 2016 22:26
simple NodeJS app to display triggered events on a smart contract
// This is a simple NodeJS app to display triggered events on a smart contract
// you need your contract ABI and deployed address and also a synced geth running
// github.com/shayanb
var optionsABI = [YOUR_CONTRACT_ABI]
var contractAddress = "0xYOUR_CONTRACT_ADDRESS"
var Web3 = require('web3');
@shayanb
shayanb / testnet_fork_data_readme
Last active November 11, 2015 08:48
Testnet blocksize fork data
MOVED TO [GitHub](https://github.com/shayanb/Testnet-blocksize-fork-data-Raw)
apparently gist trims the big files.
@shayanb
shayanb / gist:9dd8dc5c6d79b9ff6a09
Created November 10, 2015 15:39
Get multisig RedeemScript and address
from pycoin.tx.pay_to import address_for_pay_to_script, build_hash160_lookup, build_p2sh_lookup, ScriptMultisig
from pycoin.key import Key
def generate_multisig_address(priv_keys, N=3, M=2, netcode = COIN_NETWORK):
'''
Generate a multisig address from a list of pycoin keys (addresses public or private)
multisig N out of M
'''
#keys = sorted(keys, key=lambda k: k.sec_as_hex()) #sort keys to have the same multisig address from any similar list of keys
keys = []
@shayanb
shayanb / gist:70217da4701a124a027f
Last active December 8, 2015 02:11
Bibtex_to_SAFBuilder
#python script to convert bibtex for SAFBuilder CSV
#Make Papers bibtex export available to be used with SAFBuilder to make a Simple Archive Format to be able to import in dSpace (I know! lol)
import bibtexparser
import csv
import urllib2
with open('cryptolibrary.bib') as bibtex_file:
bibtex_str = bibtex_file.read()
@shayanb
shayanb / gist:b0c5f427d117bf8fabfb
Created January 23, 2015 03:35
Import MYSQL dump to Heroku (cleardb)
<?php
/*
PHP script to import MYSQL database dump in Heroku cleardb
By Shayan Eskandari 2015
export your mysql dump from phpmyadmin or with sqldump commandline -> database_scheme.sql
you have to modify the dump and remove the create database and schema details
here is one example
//database_schema.sql
@shayanb
shayanb / getUDID.m
Last active August 29, 2015 14:13 — forked from sag333ar/getUDID.m
- (NSString*)UDID {
NSString *uuidString = nil;
// get os version
NSUInteger currentOSVersion = [[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] objectAtIndex:0] integerValue];
if(currentOSVersion <= 5) {
if([[NSUserDefaults standardUserDefaults] valueForKey:@"udid"]) {
uuidString = [[NSUserDefaults standardDefaults] valueForKey:@"udid"];
} else {
CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault);