Skip to content

Instantly share code, notes, and snippets.

View liningtan's full-sized avatar
🐱

Lining Tan liningtan

🐱
View GitHub Profile
@liningtan
liningtan / bash-cheatsheet.sh
Created August 31, 2021 15:05 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@liningtan
liningtan / checkJenkins.sh
Last active October 14, 2020 20:00 — forked from julianchurchill/checkJenkins.sh
A bash script to query a Jenkins server. Use like this: 'checkJenkins.sh <jobname>' and it will query the server with the given job name every 30s. Use like this: 'checkJenkins.sh <jobname> tmux' and it will query the server once and output tmux coloured messages appropriate to display in a tmux status bar. E.g. add this to your .tmux.conf 'set …
#!/bin/bash
JENKINS_SERVER=http://my_jenkins_server
JOB=$1
JOB_QUERY=/job/${JOB}
BUILD_STATUS_QUERY=/lastBuild/api/json
JOB_STATUS_JSON=`curl --silent ${JENKINS_SERVER}${JOB_QUERY}${BUILD_STATUS_QUERY}`
CURRENT_BUILD_NUMBER_QUERY=/lastBuild/buildNumber
@liningtan
liningtan / calling_jenkin_remote.sh
Last active May 25, 2021 14:31
Remote Jenkin build
#https://JENKINS_URL/user/username/configure -> API Token
#token_auth under BuildItem -> Configure -> Build Trigger -> Trigger builds remotely
curl -X POST https://{api_token_name}:{api_token}@JENKINS_URL/job/item/buildWithParameters?token={token_auth}&PARAM=value1&PARAM2=value2
@liningtan
liningtan / gist:49f55ebb1b22574586b5832d05eae3f8
Created March 19, 2020 17:04
Avoid system wide screen-sleep policy enforced by admin
<#
Only has use when system wide display & sleep policy are enforced by admin (work laptop)
script will move the cursor & hit the cap lock every 14 minutes to prevent laptop from sleep
#>
Add-Type -AssemblyName System.Windows.Forms
while ($true)