Skip to content

Instantly share code, notes, and snippets.

View XGHeaven's full-sized avatar
🐟
Finding web future

Bradley Xu XGHeaven

🐟
Finding web future
View GitHub Profile
@TooTallNate
TooTallNate / bbs.js
Created March 16, 2012 22:42
Running a node.js REPL over `curl`
/**
* Requires node v0.7.7 or greater.
*
* To connect: $ curl -sSNT. localhost:8000
*/
var http = require('http')
, repl = require('repl')
, buf0 = new Buffer([0])

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

@toqueteos
toqueteos / sha1.go
Last active April 10, 2023 19:34
Minecraft player auth SHA-1 digest.
// You can test this online at: https://play.golang.org/p/hhayRT1VWgj
package main
import (
"crypto/sha1"
"encoding/hex"
"fmt"
"io"
"strings"
)
@clayton
clayton / ffmpeg-install.sh
Created August 9, 2013 18:55
Install FFMPEG on OS X with HomeBrew to convert Mp4 to WebM
# Installation
brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid
# Easy Peasy
ffmpeg -i video.mp4 video.webm
@james2doyle
james2doyle / node-base64-encode.js
Last active February 2, 2023 23:53
base64 encode a file with node.js and auto-detect the mimetype.
// to run: node node-base64-encode.js file
const mime = require('mime'); // npm install mime
const path = require('path');
const fs = require('fs');
// path to the file we passed in
const filepath = path.resolve(process.argv[2]);
// get the mimetype
const filemime = mime.getType(filepath);
@rmoff
rmoff / foo.md
Last active January 5, 2024 17:17
cx_Oracle install on MacOS
  1. Download Instant Client:
  • instantclient-basic-macos.x64-11.2.0.4.0.zip
  • instantclient-sdk-macos.x64-11.2.0.4.0.zip
  • instantclient-sqlplus-macos.x64-11.2.0.4.0.zip
  1. Unzip and move to /opt

  2. Create symlink

# migrating from https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git/git.plugin.zsh
# Aliases
alias g='git'
#compdef g=git
alias gst='git status'
#compdef _git gst=git-status
alias gd='git diff'
#compdef _git gd=git-diff
alias gdc='git diff --cached'
@mcfog
mcfog / gitabbr.fish
Last active November 29, 2019 07:43
abbr g git
abbr ga 'git add'
abbr gaa 'git add --all'
abbr gb 'git branch'
abbr gbda git\ branch\ --merged\ \|\ command\ grep\ -vE\ \"\^\(\\\*\|\\s\*master\\s\*\\\$\)\"\ \|\ command\ xargs\ -n\ 1\ git\ branch\ -d
abbr gbnm 'git branch --no-merged'
abbr gbr 'git branch --remote'
abbr gc 'git commit -v'
abbr gc! 'git commit -v --amend'
abbr gca 'git commit -v -a'
@XGHeaven
XGHeaven / uncarryThis.js
Created February 1, 2016 04:59
JavaScript Magic Technology
/**
* call wrapper function is equal to use call/apply to invoke function
* see follow usage
*
* @param {Function} f - need to wrapper function
*/
var uncurryThis = function(f) {
var call = Function.call;
return function() {
return call.apply(f, arguments);
@ggrandes
ggrandes / cert-generator-with-int.sh
Last active September 9, 2021 11:53
Generate X.509 Certificate (Server/Client/Mail) with OpenSSL and Intermediate CA - Linux
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Original Source:
# https://gist.github.com/ggrandes/c1765904e804db15b8c57d90299d006f
#