Skip to content

Instantly share code, notes, and snippets.

View joshua's full-sized avatar
🌮

Joshua Suggs joshua

🌮
View GitHub Profile
@kodie
kodie / updateModified.js
Last active April 15, 2024 07:02
A JavaScript function for Google Sheets that updates a specific cell with the current date/time when cell(s) are updated.
function getColumnNumberByName(name, sheet) {
if (!sheet) {
sheet = SpreadsheetApp.getActiveSheet()
}
var headers = sheet.getDataRange().offset(0, 0, 1).getValues()[0]
var column = false
for (var i = 0; i < headers.length; i++) {
if (headers[i].trim() === name) {
@zdebra
zdebra / throttled_transport.go
Created June 15, 2021 14:48
NewThrottledTransport wraps transportWrap with a rate limitter, improvement of https://gist.github.com/MelchiSalins/27c11566184116ec1629a0726e0f9af5 since it allows use of *http.Client
package main
import (
"net/http"
"time"
"golang.org/x/time/rate"
)
// ThrottledTransport Rate Limited HTTP Client
@muhqu
muhqu / amzn-music
Created April 16, 2018 11:36
Control playback of Amazon Music via command line.
#!/bin/bash
#
# The MIT License (MIT)
#
# Copyright (c) 2018 Mathias Leppich <mleppich@muhqu.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@jmound
jmound / refresh.sh
Last active August 7, 2023 10:33
Bash function to refresh all pods in all deployments by namespace
# based on the "patch deployment" strategy in this comment:
# https://github.com/kubernetes/kubernetes/issues/13488#issuecomment-372532659
# requires jq
# $1 is a valid namespace
function refresh-all-pods() {
echo
DEPLOYMENT_LIST=$(kubectl -n $1 get deployment -o json|jq -r .items[].metadata.name)
echo "Refreshing pods in all Deployments"
for deployment_name in $DEPLOYMENT_LIST ; do
MAX_BUILDS = 5
MAX_ENV_BUILDS = 2
Jenkins.instance.getAllItems(org.jenkinsci.plugins.workflow.job.WorkflowJob.class).each { it ->
def job = Jenkins.instance.getItemByFullName(it.fullName, Job.class)
def limit = (it.fullName =~ /^environment/) ? MAX_ENV_BUILDS : MAX_BUILDS
def recent = job.getBuilds().limit(limit)
println "Processing job " + it.fullName + " " + it.class + " BuildCount: " + job.getBuilds().size() + " Limit: " + limit
@abayer
abayer / Jenkinsfile
Created February 15, 2017 15:17
An example Declarative Pipeline Jenkinsfile for Feb 15 2017 demo
// A Declarative Pipeline is defined within a 'pipeline' block.
pipeline {
// agent defines where the pipeline will run.
agent {
// This also could have been 'agent any' - that has the same meaning.
label ""
// Other possible built-in agent types are 'agent none', for not running the
// top-level on any agent (which results in you needing to specify agents on
// each stage and do explicit checkouts of scm in those stages), 'docker',
@m-x-k
m-x-k / pipelineChooseDockerTags.groovy
Created November 16, 2016 22:05
Jenkins pipeline - choose docker tags
/*
* Displays input dropdown select containing docker image tags
* Manage Jenkins->Script Approval (required)
*/
node {
stage('chooseDockerTags') {
def image = "IMAGE"
def url = "https://LOCAL-DOCKER-REG:5000/v2/${image}/tags/list"
def list = getDockerImageTags(url)
@NickCraver
NickCraver / TeamCity-Dev-Build-Log.txt
Created April 30, 2016 20:02
Stack Overflow Build Log Examples
Build 'Stack Exchange Network :: New York :: SENetwork - Dev' #21007
Started 'Wed Apr 27 23:54:04 UTC 2016' on 'NY-WEB05' by 'Git'
Finished 'Wed Apr 27 23:56:21 UTC 2016' with status 'NORMAL Success'
TeamCity URL https://build/viewLog.html?buildId=477326&buildTypeId=StackExchangeNetwork_NewYork_SENetworkDev
TeamCity server version is 9.1.5 (build 37377)
[23:54:03]i: TeamCity server version is 9.1.5 (build 37377)
[23:54:03]W: bt4 (2m:17s)
[23:54:03] : projectId:project55 projectExternalId:StackExchangeNetwork_NewYork buildTypeId:bt4 buildTypeExternalId:StackExchangeNetwork_NewYork_SENetworkDev
[23:54:03] : Collecting changes in 2 VCS roots (1s)
@NickCraver
NickCraver / Build.xml
Last active July 7, 2023 16:40
Stack Overflow Build Reference Docs
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="PrepareStaticContent" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Passed in Parameters -->
<configuration></configuration>
<workingDir></workingDir>
<buildNumber></buildNumber>
<buildViews>false</buildViews>
<minifyJs>true</minifyJs>
<TargetsDirectory></TargetsDirectory>