Skip to content

Instantly share code, notes, and snippets.

@allex
allex / README.md
Created March 11, 2019 05:20 — forked from marz619/README.md
Go build LDFlags

Using the -ldflags parameter can help set variable values at compile time.

Using the example provided here:

  1. Running make build will create a build executable. Running it will result in:
$> ./build
no version (Mon YYYY)
$>
#!/bin/sh
# tool script for install ssh authorized key
# GistID: b6276c69b219714bb50c9fb43e5e9741
# Usage:
# > sh -c "$(curl -sL https://git.io/fhAOF)" -- [ -i ~/.ssh/keyfile_or_url -h use@host ]
key_id="http://jk.im.l/ssh.key"
h=
help() {
/**
* Simple node.js style script loader for modern browsers
**/
function loadScript(src, cb) {
var script = document.createElement('script');
script.async = true;
script.src = src;
script.onerror = function() {
cb(new Error("Failed to load" + src));
// GistID: 94ce5362059940e9a9f24369eba8e512 (https://git.io/fhdGF)
var isP2PEnable = (function(scaleName, scale) {
var setc = function(e, t, i, o) {
var a = e + "=" + escape(t), n = new Date();
n.setTime(n.getTime() + 60 * i * 60 * 1e3), o && (a += ";path=/ ; domain=" + (o || '')),
document.cookie = a + "; expires=" + n.toGMTString();
};
var getc = function(e) {
var o = new RegExp("(?:^|;+|\\s+)" + e + "=([^;]*)"), c = document.cookie.match(o);
return c ? c[1] : "";
#!/bin/bash
# GistID: c070a927b5ef5cb34a1f713a0f169dae
# Directories
cur=$(pwd)
tmp=$(mktemp -d)
scriptName=$(basename "$0")
# Certificate Variables
OUTPATH="./"

brew daily commands (Continuous Update)

GistID: 5f62281ce7759e22068437c2934499b9

GistURL: https://git.io/fhy5I

Author: Allex Wang (@allex)

brew cleanup formula with multiple versions

#####################################################################
## ALIASES
#####################################################################
[alias]
#################################################
## Simple / Short Aliases
#################################################
@allex
allex / jenkins-git-backup.sh
Created January 15, 2019 10:40 — forked from abayer/jenkins-git-backup.sh
Example of a script for backing up Jenkins config in git.
#!/bin/bash
#
# Copies certain kinds of known files and directories from a given Jenkins master directory
# into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em.
#
set -ex
if [ $# -ne 2 ]; then
echo usage: $0 root_dir jenkins_master
#!/bin/sh
# by allex_wang (gist_id:e58d85ee1ddc692af20f8e6758c3cd95)
tmpfile=$(mktemp /tmp/tar.XXXXXX)
trap 'rm -f -- "$tmpfile"' 0 1 2 3 9 13 15
tee $tmpfile >/dev/null
scp2() {
local host="$1" # user@host
local dir="$2" # remote directory
local cmd="(:;$3)" # remote command
[ -n "$host" ] && [ -n "$dir" ] || { echo >&2 "fatal: invalid parameters."; exit 1; }
// console.save(data[, filename])
// GistID: 221eff6a8448357e9486b708b629f942
// GistURL: https://gist.github.com/allex/221eff6a8448357e9486b708b629f942
(function(console) {
console.save = function(data, filename) {
if (!data) {
console.error('Console.save: No data')
return;
}