Skip to content

Instantly share code, notes, and snippets.

test_it() {
SECONDS=0
local connects=0
while :; do
((connects++))
if ((connects >= 10000000 && SECONDS >= 20)); then
echo $connects
echo $SECONDS
break;
fi
@jesbrd
jesbrd / GitHubApiTest.cs
Created August 2, 2018 15:13 — forked from rquackenbush/GitHubApiTest.cs
Manipulating github through api calls
using System;
using System.Threading.Tasks;
using Octokit;
using Octokit.Internal;
namespace GithubApiTest
{
class Program
{
static async Task<int> Main(string[] args)
@jesbrd
jesbrd / idle.sh
Created July 9, 2018 02:08 — forked from ikbear/idle.sh
Docker image entrypoint idle script
#!/bin/bash
echo "This is a idle script (infinite loop) to keep container running."
echo "Please replace this script."
cleanup ()
{
kill -s SIGTERM $!
exit 0
}
@jesbrd
jesbrd / openconnect.sh
Created July 9, 2018 00:39 — forked from alirezaomidi/openconnect.sh
Script to connect and disconnect to/from openconnect without pain
#!/bin/bash
# This script connects the computer to a vpn server using openconnect without pain
prog_name=$(basename $0)
# CHANGE YOUR_VPN_SERVER_DOMAIN to the VPN server you know like example.com
domain=YOUR_VPN_SERVER_DOMAIN
function help {
@jesbrd
jesbrd / serialportstream-install.sh
Last active July 7, 2018 04:56
Build, Install SerialPortStream on Ubuntu 16.04
#!/bin/bash
# Build, Install SerialPortStream
# https://github.com/jcurl/SerialPortStream
@jesbrd
jesbrd / bos.md
Last active June 22, 2018 02:39
Boondocks OS Source Builder helper script.
#!/bin/bash
# Boondocks OS Yocto Build Wrapper
set -e # fail fast
# capture the root directory of the Boondocks OS source repo.
repo_root=$(pwd)
# function onError() {
# onExit();
# }
@jesbrd
jesbrd / release.sh
Created June 14, 2018 01:40 — forked from bclinkinbeard/release.sh
Bash script to automate the Git Flow tag/release process
#!/bin/bash
# current Git branch
branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
# v1.0.0, v1.5.2, etc.
versionLabel=v$1
# establish branch and tag name variables
devBranch=develop
@jesbrd
jesbrd / build-boondocks-os-in-lxc-container.md
Last active March 6, 2019 03:06
Boondocks OS Yocto Build in an LXC Container
@jesbrd
jesbrd / mongodb_logrotate.cron
Created August 6, 2016 18:17 — forked from slimflem/mongodb_logrotate.cron
Rotate and compress mongodb logs
#!/bin/bash
# To be used as a cron job weekly (or other) placed under /etc/cron.weekly
# Will use mongodb's logrotate function, but then will compress and keep at most 12 weeks worth of rotate logs.
killall -SIGUSR1 `cat /var/run/mongodb/mongod.pid`
gzip /var/log/mongodb/*20[0-9][0-9]-*-[0-9][0-9]
logs_total=`ls -tx1 /var/log/mongodb/ | egrep "20[0-9][0-9]-.*\.gz" | wc -l`
if [ "$logs_total" -gt 12 ]; then
logs_difference=`expr $logs_total - 12`
logs_to_remove=`ls -tx1 /var/log/mongodb/ | egrep "20[0-9][0-9]-.*\.gz" | tail -n $logs_difference`
for log_file in $logs_to_remove; do