This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CGO_ENABLED=1 go build -v -o libhello.so -buildmode=c-shared libhello.go | |
python3 -c 'import ctypes;lib = ctypes.CDLL("./libhello.so");print(lib.HelloWorld())' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#replace 'string1' with 'string2' | |
sed 's/string1/string2/g' | |
#modify 'anystring1' to 'anystring2' | |
sed 's/\(.*\)1/\12/g' | |
#remove comments and blank lines | |
sed '/^ *#/d; /^ *$/d' | |
#remove trailing spaces from lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shopt -s histappend | |
export PROMPT_COMMAND='history -a' | |
export CGO_ENABLED="0" | |
export GOPATH=$HOME/go | |
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin:/usr/local/go/bin | |
COMMON_CREDITIAL='salt' | |
export GIT_SSH_COMMAND='ssh -i ~/.ssh/fake -o IdentitiesOnly=yes' | |
export GOPRIVATE=gitlab.mycompany.com | |
function gofix() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# semver: increment MAJOR version when you make incompatible API changes | |
# magic number 4b825dc642cb6eb9a060e54bf8d69288fbee4904 is git commit hash of null (before init commit) | |
MAJOR_VERSION=0 | |
MAJOR_LAST_COMMIT_HASH="4b825dc642cb6eb9a060e54bf8d69288fbee4904" | |
# semver: increment MINOR version when you add functionality in a backwards-compatible manner | |
MINOR_LAST_COMMIT_HASH=$(git rev-list --invert-grep -i --grep='fix' ${MAJOR_LAST_COMMIT_HASH}..HEAD --no-merges -n 1) | |
MINOR_VERSION=$(git rev-list --invert-grep -i --grep='fix' ${MAJOR_LAST_COMMIT_HASH}..HEAD --no-merges --count) | |
[ "${MINOR_LAST_COMMIT_HASH}" = "" ] && MINOR_LAST_COMMIT_HASH=${MAJOR_LAST_COMMIT_HASH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# FILE: cleanup_cms_caches.sh | |
# Brief: Detect CMS and clear its cache | |
# Author: @AlexDyukov | |
# Requirement: wp-cli, drush | |
if (( $# == 0 )); then | |
echo -e "site path not present\nusage: $0 /home/[a-z]/*/*/public_html/" | |
exit 1 |