Skip to content

Instantly share code, notes, and snippets.

View ahmedsajid's full-sized avatar

Ahmed Sajid ahmedsajid

View GitHub Profile
@gbolo
gbolo / go_version_switcher.sh
Last active November 6, 2019 16:01
go_version_switcher.sh
#!/usr/bin/env bash
#
# Go Version Switcher/Downloader
# THIS SCRIPT SHOULD BE SOURCED UNLESS YOU WANT TO KEEP A STATIC GOROOT OF: /opt/goroot/go
# example usage: source ./go_version_switcher.sh 1.11.5
#
# Some defaults
GO_ROOT_PATH=/opt/goroot
@silveraid
silveraid / youtube_autodl.sh
Last active February 8, 2019 17:11
Simple tool to automate fetching videos on MacOSX from YouTube
#!/bin/bash
# Simple tool to automate fetching videos on MacOSX from YouTube
# Installing dependencies:
# pip install youtube-dl
# brew install libav
echo "Resetting clipboard ..."
echo "-" | pbcopy
@merikan
merikan / Jenkinsfile
Last active November 4, 2024 08:05
Some Jenkinsfile examples
Some Jenkinsfile examples
@rverton
rverton / chrome_headless_screenshot.py
Created July 10, 2017 08:53
Make a screenshot with a headless google chrome in python
# Install chromedriver from https://sites.google.com/a/chromium.org/chromedriver/downloads
import os
from optparse import OptionParser
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
CHROME_PATH = '/usr/bin/google-chrome'
@aldaris
aldaris / buildAM13.sh
Created April 4, 2017 08:05
Shell script to build OpenAM 13.0.0 from openam-public repository
#!/bin/bash
#Run buildDJ3.sh script first in the same folder from: https://gist.github.com/aldaris/fe234d76f3940c42ae9bb5aa69b8e98e
function build() {
mvn clean install
if [ $? -ne 0 ] ; then
exit 1;
fi
}
@oifland
oifland / Jenkinsfile
Last active July 15, 2024 06:36
Loops in Jenkinsfiles
// Related to https://issues.jenkins-ci.org/browse/JENKINS-26481
abcs = ['a', 'b', 'c']
node('master') {
stage('Test 1: loop of echo statements') {
echo_all(abcs)
}
stage('Test 2: loop of sh commands') {
@sandeepraju
sandeepraju / ttfb.sh
Created July 20, 2016 21:17
curl command to check the time to first byte
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
@lilongen
lilongen / run-ansible-with-any-host-without-inventory
Last active May 5, 2023 23:16
How to run Ansible without specifying the inventory but the host directly?
Question:
. How to run Ansible without specifying the inventory but the host directly?
. Run a playbook or command with arbitrary host not in the inventory hosts list?
. run ansible with arbitrary host/ip without inventory?
Answer:
Surprisingly, the trick is to append a ,
The host parameter preceding the , can be either a hostname or an IPv4/v6 address.
ansible all -i example.com,
@p3t3r67x0
p3t3r67x0 / openssl_commands.md
Last active May 22, 2024 02:19
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@cgmartin
cgmartin / check-certs.sh
Created January 17, 2016 18:00
Bash SSL Certificate Expiration Check
#!/bin/bash
TARGET="mysite.example.net";
RECIPIENT="[email protected]";
DAYS=7;
echo "checking if $TARGET expires in less than $DAYS days";
expirationdate=$(date -d "$(: | openssl s_client -connect $TARGET:443 -servername $TARGET 2>/dev/null \
| openssl x509 -text \
| grep 'Not After' \
|awk '{print $4,$5,$7}')" '+%s');
in7days=$(($(date +%s) + (86400*$DAYS)));