Skip to content

Instantly share code, notes, and snippets.

View konstruktoid's full-sized avatar
🤖

Thomas Sjögren konstruktoid

🤖
  • Sweden
  • 19:52 (UTC +02:00)
  • LinkedIn in/thosjo
View GitHub Profile
@konstruktoid
konstruktoid / repoClone.sh
Last active May 2, 2024 20:58
Clone all repositories for a GitHub user and push to origin from upstream.
#!/bin/bash
set -eu -o pipefail
USER=""
PAGE=1
REPOTMP="$(mktemp)"
PUSH=0
curl -s "https://api.github.com/users/${USER}/repos?page=${PAGE}&per_page=100" |\
grep 'ssh_url' | cut -d \" -f 4 > "${REPOTMP}"
@konstruktoid
konstruktoid / windows.yml
Last active April 13, 2021 08:49
Windows 10 configuration and application recommendations for increased security and privacy.
---
operatingsystem: windows
applications:
- antivirus (Microsoft Defender, ...)
- bleachbit
- firefox
plugins:
- https anywhere
- ublock
- privacy badger
### Keybase proof
I hereby claim:
* I am konstruktoid on github.
* I am konstruktoid (https://keybase.io/konstruktoid) on keybase.
* I have a public key ASBAeDNxQphVebofQdKNcdWQdQbrkCoOLPeghZN3vP1m6Ao
To claim this, I am signing this object:
$ cat /etc/systemd/system/jenkins.service
[Unit]
Description=Jenkins - open source automation server
Before=multi-user.target
After=network-online.target
[Service]
ExecStart=/etc/init.d/jenkins start
ExecStop=/etc/init.d/jenkins stop
CapabilityBoundingSet=~CAP_SYS_PTRACE
@konstruktoid
konstruktoid / Vagrantfile
Created November 8, 2018 14:32
Ubuntu ZFS Vagrantfile
Vagrant.configure(2) do |config|
config.vm.define "zfsU01" do |zfsU01|
zfsU01.vm.box = "ubuntu/bionic64"
zfsU01.ssh.insert_key = true
zfsU01.vm.network "private_network", ip:"10.2.3.4"
zfsU01.vm.hostname = "zfsU01"
zfsU01.vm.provision "shell",
inline: "apt-get update && apt-get -y upgrade && apt-get -y install zfsutils-linux --no-install-recommends"
zfsU01dataDisk1 = './zfsU01dataDisk1.vdi'
#!/bin/sh
PROJNAME="$(basename "$(git rev-parse --show-toplevel)")"
CONTRIBUTORS="$(git shortlog -sne | awk '{$1=""; print $0}' | sed 's/^ /* /g' | sort -i -f -k2)"
DATE="$(LANG=C date --utc)"
{
echo "The following people, listed in alphabetical order, have contributed to ${PROJNAME}:"
echo
echo "${CONTRIBUTORS}"
@konstruktoid
konstruktoid / getReplicationInfo.py
Last active April 23, 2021 03:54
replacing eval getReplicationInfo with python functions -- https://jira.mongodb.org/browse/PYTHON-1717
def oplogstats(connection):
c = connection
localdb = c["local"]
if "oplog.rs" in localdb.collection_names():
collstats = dict()
collstats.clear()
collstats = localdb.command("collstats", "oplog.rs")
return collstats
#!/bin/sh
MAX_RAM_IN_MB=768
DEBUG=0
if [ -f '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java' ]; then
JAVA='/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
else
JAVA=java
#!/bin/sh
if command -v gem; then
if gem --version | grep -q '^3'; then
gem update
fi
fi
if command -v brew; then
brew update
#!/bin/sh
RELEASE_DATE=
for p in $(curl -sSL 'https://kernel.ubuntu.com/~kernel-ppa/mainline/daily/current/HEADER.html' | grep -E '.*all\.deb|.*generic.*amd64\.deb' | sed -e 's/.*ref="//g' -e 's/">.*//g'| sort | uniq); do
wget -nc "https://kernel.ubuntu.com/~kernel-ppa/mainline/daily/current/$p"
RELEASE_DATE="$(echo "$p" | awk -F '.' '{print $6}' | sed 's/_.*//g')"
done
if ! dpkg -l | grep -qE "linux.*$RELEASE_DATE.*"; then
find . -name "*modules*$RELEASE_DATE*.deb" -type f | while read -r m; do