Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am shawn111 on github.
  • I am shawnwang (https://keybase.io/shawnwang) on keybase.
  • I have a public key ASApnoWh3NBi48LrKrGir7Ms-EXO1Obtp3Tojsn5mLYkhQo

To claim this, I am signing this object:

@shawn111
shawn111 / restart-jujud.sh
Last active April 6, 2017 08:55
Juju nodes might lost connection with juju agent. This script help us to restart those jujud.
#!/bin/sh
# https://pastebin.canonical.com/183117/
# # trusty
# for j in $(initctl list | awk '/jujud/ {print $1}'); do echo sudo restart $j; done
# # xenial
# for j in $(systemctl list-unit-files | awk '/jujud/ {print $1}'); do echo sudo systemctl restart $j; done
for i in $(juju status --format yaml| grep 'agent lost' | awk '{print $1}');
do
## for juju 1
python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)'
#!/bin/bash
declare -i ID
ID=`xinput list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
declare -i STATE
STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
if [ $STATE -eq 1 ]
then
xinput disable $ID
echo "Touchpad disabled."
SERVER="http://xxx:3000"
REPO="foo"
ORG="foo"
#API="user/repos"
API="org/$ORG/repos"
TOKEN="b2a36575cffaf2b291863f023e2027c26e87b3c9"
curl -H 'content-type: application/json' -H \'Authorization: token $TOKEN\' -d \'{"name":"$REPO"}\' -X POST "$SERVER/api/v1/$API"
[koji-es7.4-os]
name=koji es7.4-os
username=escore
password=escore
baseurl=http://mirror.easystack.io/koji-escl/repos/es7.4-os/latest/x86_64/
type=rpm
enabled=1
failovermethod=priority
[koji-es7.4-docker]
P=/home/jasonwucj/Works/verify-koji-build/7.4.1708/vault.es.bootstrap/os/Source/SPackages
for f in ${P}/[b-z]*; do
pkg=`rpm -qp $f --queryformat '%{NAME}\n'`
echo $pkg
koji add-pkg es7.4-os $pkg --owner jason.wu
koji build es7.4-os $f --nowait
done
@shawn111
shawn111 / gen_patch.sh
Last active January 19, 2018 12:45
hello #tag_abc
## helper function to create patch
##
## Usage:
###
### download:
### $ curl https://gist.githubusercontent.com/shawn111/64ee0125acab30c619e129c52de94082/raw/273d7f91a3adb75603800d260cb0b62ca42f2262 -o xx.sh
###
### copy the function into .bashrc
###
### Run below command in your git project dir.
[escore-atomic]
name=ESCore-7 - atomic
#baseurl=http://mirror.easystack.io/ESCL/vault.es/7.4.1708/atomic/x86_64/
baseurl=http://mirror.easystack.io/ESCL/vault.es/7.3.1611/atomic/x86_64/
#baseurl=http://mirror.easystack.io/koji-escl/repos/es7.4-docker/latest/x86_64/
enabled=1
gpgcheck=0
username=escore
password=escore
#!/bin/sh
set -e
set -x
RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp selinux"}"
PROXY_LDFLAGS="-linkmode=external"
TARGET_PATH=${TARGET_PATH:-"/usr/local/bin"}