Skip to content

Instantly share code, notes, and snippets.

@hoducha
hoducha / output
Last active October 18, 2018 04:13 — forked from tj/output
Show size of imports
#!/bin/sh
eval `go build -work -a 2>&1` && find $WORK -type f -name "*.a" | xargs -I{} du -hxs "{}" | gsort -rh | sed -e s:${WORK}/::g
@hoducha
hoducha / CryptocurrencyPrices.30s.sh
Last active July 31, 2018 05:11
A bitbar plugin that displays the current cryptocurrency prices in the menu bar
#!/bin/bash
# <bitbar.title>Cryptocurrency Prices</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Ha Ho</bitbar.author>
# <bitbar.author.github>hoducha</bitbar.author.github>
# <bitbar.desc>Displays cryptocurrency prices from https://coinmarketcap.com</bitbar.desc>
# <bitbar.image>https://www.screencast.com/t/BUREirqk</bitbar.image>
# <bitbar.dependencies>bash, python</bitbar.dependencies>
#
/*
* © 2016 - Julián Acosta
* License: CC BY-SA 4.0 (http://creativecommons.org/licenses/by-sa/4.0/)
*
* Print your own logo in developer tools!
*
* Step 1: Convert your logo to ASCII text here: http://picascii.com (I used color output)
* Note: Is possible that you'll have to resize your photo in order to retain aspect ratio
* Step 2: Remove the <pre></pre> tag that is surrounding the generated code, replace with "[" and "]"
* Step 3: Run the following regexes (*DON'T ALTER THE ORDER*) in order to convert to JSON (Works in PHPStorm and Sublime Text 2):
@hoducha
hoducha / HOWTO.md
Created May 30, 2017 04:21 — forked from cvan/HOWTO.md
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@hoducha
hoducha / letsencrypt-renew-nginx.sh
Created December 4, 2016 08:22
This script run letsencrypt renew and reload Nginx if there is any certificates renewed
#!/bin/sh
# This script renews all the Let's Encrypt certificates with a validity < 30 days
RENEW_LOG=/var/log/letsencrypt/renew.log
if ! letsencrypt renew > $RENEW_LOG 2>&1 ; then
echo Automated renewal failed:
cat $RENEW_LOG
exit 1
fi
@hoducha
hoducha / smtp.js
Created November 14, 2016 15:22 — forked from btoews/smtp.js
node.js SMTP Server
/*
smtpd.js is SMTP server written for node.js
#Changes#
-made to work with 0.6.2 (replaced sys.print with console.log)
-a few bug fixes
sudo node smtpd.js
@hoducha
hoducha / domain-checker.sh
Created July 29, 2016 03:59
Domain checker shell script
#!/bin/bash
### REQUIREMENTS
# sudo apt-get install whois
# sudo apt-get install curl
### CONSTANTS
# By default the script uses a 500ms delay.
sleep=0.5
notFound='No match'