Skip to content

Instantly share code, notes, and snippets.

View nodejs-ubuntu-bind-port-80.md

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@ye
ye / homebrew-httpd24.sh
Created Sep 24, 2014
Homebrew make error on httpd24 and Xcode 6.0.1
View homebrew-httpd24.sh
[ye-mbp:~] ywang$ xcodebuild -version
Xcode 6.0.1
Build version 6A317
[ye-mbp:~] ywang$ brew install -v httpd24
==> Downloading https://archive.apache.org/dist/httpd/httpd-2.4.10.tar.bz2
Already downloaded: /Library/Caches/Homebrew/httpd24-2.4.10.tar.bz2
==> Verifying httpd24-2.4.10.tar.bz2 checksum
tar xf /Library/Caches/Homebrew/httpd24-2.4.10.tar.bz2
==> tar -zxpv -C /private/tmp/httpd24-Ttbn7h/httpd-2.4.10/srclib/apr --strip-components=1 -f /private/tmp/httpd24-Ttbn7h/httpd-2.4.10/srclib/apr-1.5.1.tar.gz
x libapr.mak
View sshpub-to-rsa
#!/usr/bin/env python
# with help and inspiration from
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure)
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html
import sys
import base64
import struct
View keybase.md

Keybase proof

I hereby claim:

  • I am ye on github.
  • I am yewang (https://keybase.io/yewang) on keybase.
  • I have a public key whose fingerprint is DDFF 7612 5CCE 0A61 0657 6BF5 E9DF 8AFD C6D7 A866

To claim this, I am signing this object:

@ye
ye / date-range-validation.js
Last active Dec 13, 2015
Validate Date Range (From - To).
View date-range-validation.js
var dv = function(date){
var matches = /^(\d{1,2})[-\/](\d{1,2})[-\/](\d{4})$/.exec(date);
if (matches == null) return {'isValid': false};
var m = matches[1] - 1;
var d = matches[2];
var y = matches[3];
var cd = new Date(y, m, d);
var isValid = (cd.getDate() == d) && (cd.getMonth() == m) && (cd.getFullYear() == y);
return {'isValid': isValid, 'month':m, 'day':d, 'year':y}
@ye
ye / ui.coverflow.js
Created Jun 24, 2013
jQuery Cover Flow Plugin
View ui.coverflow.js
/*
* jQuery UI CoverFlow
Re-written for jQueryUI 1.8.6/jQuery core 1.4.4+ by Addy Osmani with adjustments
Maintenance updates for 1.8.9/jQuery core 1.5, 1.6.2 made.
Original Component: Paul Bakaus for jQueryUI 1.7
*/
(function($){
function getPrefix( prop ){
@ye
ye / .gitconfig
Last active Jan 2, 2016 — forked from igal/gist:53855
Local Git config file. To be put in as ~/.gitconfig
View .gitconfig
# Aliases for common git commands. E.g., enter "git d" for "git diff"
# These settings live in the ~/.gitconfig file.
[alias]
b = branch
br = branch
ba = branch -a
ci = commit
co = checkout
d = diff
@ye
ye / setuptools-issue-885.log
Created Apr 7, 2017
Error log for setuptools issue #885
View setuptools-issue-885.log
$ docker build -t test .
Sending build context to Docker daemon 34.82kB
Step 1/11 : FROM python:3.5-slim
---> 8c228f31ddc5
Step 2/11 : MAINTAINER Ye Wang ye@noreply.github.com
---> Using cache
---> 08e32cddacf0
Step 3/11 : RUN apt-get update && apt-get install -y --no-install-recommends -qq cron rsyslog wget && apt-get clean && rm -rf /var/lib/apt/lists/*
---> Using cache
---> b11fdb159dc8
@ye
ye / openssl_commands.md
Created Dec 4, 2018 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys
View openssl_commands.md

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@ye
ye / list-changes-between-branches.sh
Created Oct 21, 2019 — forked from iodic/list-changes-between-branches.sh
Show a list of commit differences between git branches
View list-changes-between-branches.sh
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative master..develop