Skip to content

Instantly share code, notes, and snippets.

Allex allex

Block or report user

Report or block allex

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist.sh
#!/bin/sh
# GistID: 8f9a8a45e86f0edef6caea81f0795031
echoerr() {
echo "$@" 1>&2;
}
error() {
if [ -t 1 ]; then
echoerr "\033[1;31m$@\033[0m"
else
echoerr "$@"
@allex
allex / README.md
Created Mar 11, 2019 — forked from marz619/README.md
Go build LDFlags
View README.md

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)
$>
View add-ssh-key.sh
#!/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() {
View loadscript.js
/**
* 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));
View snippet_scale.js
// 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] : "";
View self-signed-tls
#!/bin/bash
# GistID: c070a927b5ef5cb34a1f713a0f169dae
# Directories
cur=$(pwd)
tmp=$(mktemp -d)
scriptName=$(basename "$0")
# Certificate Variables
OUTPATH="./"
View brew-command.md

brew daily commands (Continuous Update)

GistID: 5f62281ce7759e22068437c2934499b9

GistURL: https://git.io/fhy5I

Author: Allex Wang (@allex)

brew cleanup formula with multiple versions

View .gitconfig
#####################################################################
## ALIASES
#####################################################################
[alias]
#################################################
## Simple / Short Aliases
#################################################
@allex
allex / jenkins-git-backup.sh
Created Jan 15, 2019 — forked from abayer/jenkins-git-backup.sh
Example of a script for backing up Jenkins config in git.
View jenkins-git-backup.sh
#!/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
View scp.sh
#!/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 "invalid parameters."; exit; }
You can’t perform that action at this time.