Skip to content

Instantly share code, notes, and snippets.

View ChrisWelsh-mis's full-sized avatar

Christopher Welsh ChrisWelsh-mis

View GitHub Profile
@ankurk91
ankurk91 / bash_profile.md
Last active October 22, 2023 12:16
:octocat: Git branch name in Linux/Mac Bash Terminal

Mac OS : Show your git branch name on your bash terminal

⚠️ Does not work in zsh terminal

Add these lines in your ~/.bash_profile file

# Show current git branch name
parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
#!/bin/bash
group_name='<log-group-name>'
start_seconds_ago=3600
aws_cmd_opts= # e.g. "--profile <profile-name>"
# Usage: get_loglines "<log-group-name>" <start-time>
get_loglines() {
aws $aws_cmd_opts --output text logs filter-log-events \
--log-group-name "$1" \

default.conf

server {
    listen 443;
    server_name homelab.example.com;

    access_log /var/log/nginx/homelab.example.com.access.log;
    error_log /var/log/nginx/homelab.example.com.error.log;

root /var/www/html;

@micw
micw / install_jenkins_plugin.sh
Last active August 11, 2023 06:14
Script to install one or more jenkins plugins including dependencies while jenkins is offline
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "USAGE: $0 plugin1 plugin2 ..."
exit 1
fi
plugin_dir=/var/lib/jenkins/plugins
@liuyix
liuyix / file_exists.sh
Created May 6, 2013 03:12
Check if a file exists with wildcard in shell script link:http://stackoverflow.com/a/6364244
if ls /path/to/your/files* &> /dev/null; then
echo "files do exist"
else
echo "files do not exist"
fi
@kellyrob99
kellyrob99 / updateAllPlugins.groovy
Created February 25, 2012 06:51
Jenkins/Hudson recipe for updating all Plugins using the CLI
def findPluginsWithUpdates = '''
Hudson.instance.pluginManager.plugins.inject([]) { List toUpdate, plugin ->
if(plugin.hasUpdate())
{
toUpdate << plugin.shortName
}
toUpdate
}.inspect()
'''
OutputStream updateablePlugins = new ByteArrayOutputStream()