Skip to content

Instantly share code, notes, and snippets.

@fusetim
fusetim / protonvpn-wireguard-generator.py
Last active April 18, 2025 01:31
Generate lots of Wireguard configuration for your ProtonVPN Account.
import http.client
import http.cookies
import json
import base64
import hashlib
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import x25519
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives import hashes
@maurobaraldi
maurobaraldi / systemd.py
Last active July 8, 2022 01:10
Self healing systemd services if it is in failed status.
#!/usr/bin/env python3
from subprocess import (
Popen,
PIPE
)
class Service(object):
def __init__(self, service_name):
@smoser
smoser / README.md
Last active May 22, 2024 12:59
subprocess python wrapper named 'subp'.

subp - a python subprocess wrapper

This is just a wrapper around python subprocess that I like to use. It originated during cloud-init development.

Some things that I like about it:

  • SubpResult prints well.
  • times how long subpocesses take, that is available in the SubpResult.
  • takes a timeout and a signal to send to the subprocess. The python standard library will only ever send SIGKILL which does not give the process time to cleanup.
@arc279
arc279 / urlparse.jq
Created June 28, 2022 08:51
urlparse for jq
def mergeHeader:
[
"scheme",
"user",
"password",
"domain",
"path",
"querystring",
"fragment"
] as $header
@akanchhaS
akanchhaS / README.md
Last active April 12, 2023 16:18
TeamCity Docker compose

Setting up team city server and agent on your local machine with Snyk security plugin

TeamCity is one of the popular Build Automation tools and requires running of the Server and agent.

There are different ways of installing it which you can read more about here. This document specifically lists out the steps of running it locally.

Note: This doc covers basic steps to get the Teamcity and snyk security plugin set up and running.

Prerequisites

@beltiras
beltiras / cto.py
Last active August 27, 2023 02:45
import time
import datetime
def timing_protect(constant_time):
"""
The jitter will depend not on runtime but activity on the system writ large
@Dyrcona
Dyrcona / git-cherry-log
Created June 18, 2022 17:54
Use this like git cherry except it outputs the log messages of commits in head that are not in upstream. It could be useful for summarinzing changes or writing release notes.
#!/usr/bin/env python3
# -*- Mode: python; coding: utf-8 -*-
# ---------------------------------------------------------------
# Copyright © 2015, 2022 Jason J.A. Stephenson <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
@tuklusan
tuklusan / zerofree.sh
Last active July 4, 2022 23:26
A shell script to defragment Linux ext4 partitions and fill empty space with zeroes for compact backup of virtual machine. See https://supratim-sanyal.blogspot.com/2016/12/zero-out-free-disk-space-on-virtual.html
#!/bin/bash -x
# * ----------------------------------------------------------------------------
# * "THE BEER-WARE LICENSE" (Revision 42):
# * Supratim Sanyal wrote this file. As long as you retain this notice you
# * can do whatever you want with this stuff. If we meet some day, and you think
# * this stuff is worth it, you can buy me a beer in return.
# * https://www.emailmeform.com/builder/form/65c8aanX6uJ8RVa
# * ----------------------------------------------------------------------------
@Dyrcona
Dyrcona / version-stamp-files
Last active September 24, 2024 14:34
A bash script to stamp versions in Evergreen files for a new release.
#!/bin/bash
# ---------------------------------------------------------------
# Copyright © 2022, 2024 Jason J.A. Stephenson <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@aguytech
aguytech / doc.md
Last active August 28, 2022 03:55
[bash-completion] personal bash completions #bash #bashroot #tips

https://opensource.com/article/18/3/creating-bash-completion-script

COMPREPLY

an array variable used to store the completions. The completion mechanism uses this variable to display its contents as completions

COMPREPLY=( $(compgen -W "now tomorrow never" -- ${COMP_WORDS[COMP_CWORD]}) ) # propose given words at each let choose the first completion from given words and repeat it after (replace)
COMPREPLY=( $(compgen -W "now tomorrow never" "${COMP_WORDS[1]}") ) # let choose the first completion from given words and repeat it after (replace)