Instantly share code, notes, and snippets.


Host Your Site Under Your Domain on IPFS

This is a step-by-step tutorial for hosting your website under your domain on IPFS, from zero, on a DigitalOcean Ubuntu 16.04.3 x64 Droplet (i am using the $10 variant with 2GB RAM).

Install IPFS

Log in as root.

First, make sure the system is up to date, and install tar and wget:


Keybase proof

I hereby claim:

  • I am wechain on github.
  • I am wechain ( on keybase.
  • I have a public key ASD6DRr75VBZgUIxOC8Yfq_zMmXgMYG-jT3UiUo5r1MdeQo

To claim this, I am signing this object:



Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

View schema.sql
-- --------------------------------------------------------
-- Host:
-- Server version: 5.5.36 - MySQL Community Server (GPL)
-- Server OS: Win64
-- HeidiSQL Version:
-- --------------------------------------------------------
/*!40101 SET NAMES utf8 */;
View importer.js
// data importer
// this was made in the early days of steem
// a lot of things are wrong in it:
// how it doesnt use steemjs (it uses a super old module called steem rpc)
// the way it refreshes every existing accounts without priority for active accounts
// the way it stores the data (especially the history table)
// the way it counts followers (theres a much better API function for it now)
// it doesnt count delegation numbers
View gist:c59766c6b7a67913c8f3d30728c1e532
#To Get List of Hardware
sudo networksetup -listallhardwareports
#To Disable IPv6 on Wifi Adapter
sudo networksetup -setv6off wi-fi
#To Disable IPv6 on Built-in Ethernet Adapter
sudo networksetup -setv6off Ethernet
View brewfile
cask_args appdir: '/Applications'
# 1 taps
# homebrew dupes
tap 'homebrew/dupes'
# homebrew versions
#!/usr/bin/env bash
# Ask for the administrator password upfront
echo 'Please enter your password to grant sudo-rights:'
sudo -v
echo 'Empty the Trash on all mounted volumes and the main HDD...'
sudo rm -rfv /Volumes/*/.Trashes &>/dev/null
sudo rm -rfv ~/.Trash &>/dev/null
sudo du -gxd 5 / | awk '$1 >= 5{print}'
cd ~/Dev
du -d 1 -h
find . -name "node_modules" -print -exec rm -rf {} ";"

Setup OSX 10.X with a Clean Install

About once a year, my machine gets pretty sluggish and it's time to start fresh. Here's the process I use to update it with everything I need.

1. Start with a Fresh Install of OS X

  • Back up all photos, music, apps, iTunes library, keychains, etc.
  • Deauthorize iTunes and Photoshop.
  • Deactivate CleanMyMac 3 license.
  • 1Password, Dropbox, Evenote sync