Skip to content

Instantly share code, notes, and snippets.

View address_calculation.js
function buildCreate2Address(senderAddress, saltHex, bytecode) {
return web3.utils.toChecksumAddress(`0x${web3.utils.sha3(`0x${[
'ff',
senderAddress,
saltHex,
web3.utils.sha3(bytecode)
].map(x => x.replace(/0x/, ''))
.join('')}`).slice(-40)}`);
}
@gagarine
gagarine / install-clamav-osx.md
Last active Nov 23, 2022
Howto Install clamav on OSX with brew
View install-clamav-osx.md

Howto Install clamav on OSX with brew

Note: on legacy intel system the path may be /usr/local/etc/clamav instead of /opt/homebrew/etc/clamav/

$ brew install clamav
$ cd /opt/homebrew/etc/clamav/
$ cp freshclam.conf.sample freshclam.conf
View gist:6249142
#created by @nthgergo
set :application, "APPLICATION_NAME"
set :scm, :git
set :repository, "GIT_URL"
set :user, "ec2-user"
set :ssh_options, { :forward_agent => true }
default_run_options[:pty] = true
set :use_sudo, false
set :branch, "master"
@ndarville
ndarville / business-models.md
Last active Nov 6, 2022
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.
View business-models.md

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@lukewpatterson
lukewpatterson / gist:4242707
Created Dec 9, 2012
squeezing private SSH key into .travis.yml file
View gist:4242707
Tricks to add encrypted private SSH key to .travis.yml file
To encrypt the private SSH key into the "-secure: xxxxx....." lines to place in the .travis.yml file, generate a deploy key then run: (to see what the encrypted data looks like, see an example here: https://github.com/veewee-community/veewee-push/blob/486102e6f508214b04414074c921475e5943f682/.travis.yml#L21
base64 --wrap=0 ~/.ssh/id_rsa > ~/.ssh/id_rsa_base64
ENCRYPTION_FILTER="echo \$(echo \"-\")\$(travis encrypt veewee-community/veewee-push \"\$FILE='\`cat $FILE\`'\" | grep secure:)"
split --bytes=100 --numeric-suffixes --suffix-length=2 --filter="$ENCRYPTION_FILTER" ~/.ssh/id_rsa_base64 id_rsa_
@gordonbrander
gordonbrander / ID.js
Last active Oct 26, 2022
ID - a unique ID/name generator for JavaScript
View ID.js
// Do not use. Use Symbol() instead.
@nherment
nherment / backup.sh
Created Feb 29, 2012
Backup and restore an Elastic search index (shamelessly copied from http://tech.superhappykittymeow.com/?p=296)
View backup.sh
#!/bin/bash
# herein we backup our indexes! this script should run at like 6pm or something, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files, create a restore script, and push it all up to S3.
TODAY=`date +"%Y.%m.%d"`
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/"
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
BACKUPDIR="/mnt/es-backups/"
YEARMONTH=`date +"%Y-%m"`
@jamesarosen
jamesarosen / 04_jshint.rake
Created May 2, 2011
Javascript Loves CI: Jenkins + Jasmine + PhantomJS + JSHint
View 04_jshint.rake
namespace :jshint do
task :require do
sh "which jshint" do |ok, res|
fail 'Cannot find jshint on $PATH' unless ok
end
end
task :check => 'jshint:require' do
project_root = File.expand_path('../../', File.dirname(__FILE__))
config_file = File.join(project_root, 'config', 'jshint.json')
@ded
ded / domready.js
Created Feb 24, 2011
Smallest x-browser DOM Ready, ever
View domready.js
function r(f){/in/(document.readyState)?setTimeout(r,9,f):f()}