Skip to content

Instantly share code, notes, and snippets.

View wsams's full-sized avatar
🫖

Weldon Sams wsams

🫖
View GitHub Profile
@maurobaraldi
maurobaraldi / bumpversion.py
Created May 8, 2019 20:04
Bump version from YAML files. Used to bump version form Helm chart files.
#!/usr/bin/env python3
import yaml
def version(filename):
'''Load version from Chart.yaml file.'''
with open(filename, 'r') as f:
return yaml.load(f).get('version')
def set(filename, major, minor, patch):
@afair
afair / http_request.php
Last active December 24, 2022 06:18
PHP Function to make a remote HTTP request (POST, Authentication, API, Files, etc.) and returns the response
<?php
/**
* Makes a remote HTTP request and returns the response.
*
* @author Allen Fair <allen.fair@gmail.com>
* @copyright 2018 Allen Fair
* @license https://opensource.org/licenses/MIT MIT
*
* @param string $url The full URL endpoint: "https://example.com/endpoint"
* @param array $opt An Associative Array of extended request options
@frakman1
frakman1 / pre-receive
Last active November 15, 2022 17:16
pre-receive hook in python to enforce commit message rules (and log violations)
#!/usr/bin/python
# coding: utf-8
import sys
import re
import subprocess
import datetime
class bcolors:
HEADER = '\033[95m'
@akash1233
akash1233 / pre-receive.sh
Last active April 16, 2024 02:38
pre-receive git hooks for checking the commit message
#!/bin/bash
#
# check commit messages for pivotal tracker issue numbers formatted as [#stort-id]along with commit message
REGEX="\[#[0-9]*\]"
ERROR_MSG="[POLICY] The commit doesn't reference a PIVOTAL tracker issue"
while read OLDREV NEWREV REFNAME ; do
for COMMIT in `git rev-list $OLDREV..$NEWREV`;
do
MESSAGE=`git cat-file commit $COMMIT | sed '1,/^$/d'`
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active March 6, 2024 18:14
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@helderco
helderco / db-open
Created October 6, 2015 14:51
Script to open a mysql database in Sequel Pro from a service in docker-compose.
#!/bin/bash
set -e
show_help() {
cat << EOF
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE]
${0##*/} -h
Open a standard connection in Sequel PRO.
@tadly
tadly / pacaur_install.sh
Last active August 30, 2023 13:15
A simple shell script to quickly / easily install "pacaur" on archlinux
#!/bin/sh
#
# !!! IMPORTANT !!!
# As of 2017-12-14, pacaur is unmaintained (https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144)
# For alternatives see the arch wiki: https://wiki.archlinux.org/index.php/AUR_helpers#Active
# pacaur seems to get occasional updates to fix breaking changes due to pacman updates though.
#
# If you are new to arch, I encourage you to at least read and understand what
# this script does befor blindley running it.
# That's why I didn't make a one-liner out of it so you have an easier time
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@satoruhiga
satoruhiga / mov2gif.py
Last active August 24, 2022 08:43
convert mov to gif animation
#!/usr/bin/env python
'''
DEPENDENCIES:
$ brew install ffmpeg
$ brew install imagemagick
$ python ./mov2gif.py input.mov output.gif 15
'''
@vibragiel
vibragiel / duptools-gdrive.sh
Last active August 25, 2017 21:46 — forked from tsileo/duptools.sh
An example on how to use duplicity to perform encrypted incremental backups on Google Drive. Changes over tileo's original script: Google Drive instead of S3 as backend storage. Zenity dialogs to ask for credentials. IGNORE variable to exclude a list of directories from the backup. Verbosity raised to level 8. Activated asynchronous uploads.
#!/bin/bash
# directories to be included, space separated
SOURCE="/home/chewie /etc"
# directories to be excluded, space separated
IGNORE="/home/chewie/Downloads /home/chewie/Steam"
DRIVE_FOLDER="duplicity-backup"
LOGFILE=/home/chewie/duplicity.log
# set email to receive a backup report
EMAIL=""