Skip to content

Instantly share code, notes, and snippets.

@WizKid
WizKid / gist:1170297
Created August 25, 2011 09:16
Remove comments in a JSON file
def removecomments(s):
inCommentSingle = False
inCommentMulti = False
inString = False
t = []
l = len(s)
i = 0
fromIndex = 0
@devongovett
devongovett / pull_request.sh
Created April 10, 2014 16:32
Bash script to make a pull request from the current git repository. Tries the upstream remote if possible, otherwise uses origin.
# put this in your .bash_profile
pull_request() {
to_branch=$1
if [ -z $to_branch ]; then
to_branch="master"
fi
# try the upstream branch if possible, otherwise origin will do
upstream=$(git config --get remote.upstream.url)
origin=$(git config --get remote.origin.url)
@eliranmal
eliranmal / check-links.sh
Last active March 21, 2022 18:58
takes a list of links as input, and checks each for a successful response
@eliranmal
eliranmal / gitlab-mr-links-check.md
Last active March 16, 2022 12:03
a how-to on checking for broken links on GitLab merge requests
@eliranmal
eliranmal / redhat-bash-prompt.md
Last active December 13, 2021 05:21
customize your prompt line to match your fedora

redhat bash prompt

customize your prompt line to match your fedora

how to

  • add this somewhere in your .bash_profile (or .bashrc)
@willurd
willurd / set-wallpaper.sh
Last active January 18, 2020 11:02
Set the Desktop Background for all of your open Spaces in Mountain Lion
read -e IMAGE;
defaults write com.apple.desktop Background "{default = {ImageFilePath='$IMAGE'; };}"
killall Dock
@eliranmal
eliranmal / json.sh
Last active June 11, 2019 16:56
a bash json parser via node js
#!/usr/bin/env bash
# example usage:
#
# json_response="$(curl --flag http://whatever.man)" # -> { "status": 22, "errors": [ { "message": "oh no!" } ] }
# errors="$(echo "$json_response" | json_get "errors")"
# [[ $errors ]] && {
# msg="$(echo "$errors" | json_get "0" | json_get "message")"
# }
json_get() {
@eliranmal
eliranmal / teamcity-auto-run.js
Last active August 8, 2018 22:59
periodically triggers teamcity builds. just stuff it in the dev console (but don't forget it running!)
(function (triggerIntervalSeconds) {
triggerIntervalSeconds = triggerIntervalSeconds || (60 * 5);
var runInterval = triggerIntervalSeconds * 1000;
var runBuildTimeout = 300;
function runBuild(done) {
var runBtn = jQuery("button:contains(Run)")[0];
console.log('opening build run dialog...');
@dzzh
dzzh / teamcity_github_pr_branch.py
Created March 7, 2017 15:07
Inject source and target branches from Github pull request into TeamCity CI
#!/usr/bin/env python
import os
import sys
import urllib2
import json
'''
This script queries Github for source and target branches of a pull request
and updates environment variables at TeamCity CI to make these variable