Skip to content

Instantly share code, notes, and snippets.

View benschweizer's full-sized avatar

Benjamin Schweizer benschweizer

View GitHub Profile
#!/bin/bash
#
FN="${1%.p12}"
PASS="$2"
# cert
openssl pkcs12 -in "$FN.p12" -passin "pass:$PASS" -passout "pass:$PASS" -clcerts | openssl x509 -passin "pass:$PASS" -subject -issuer -modulus > "$FN.pem"
openssl pkcs12 -in "$FN.p12" -passin "pass:$PASS" -passout "pass:$PASS" -clcerts | openssl x509 -passin "pass:$PASS" -subject -issuer -modulus > "$FN.crt"
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# <xbar.title>StatusPage.io</xbar.title>
# <xbar.version>v1.0.0</xbar.version>
# <xbar.author>Stephen Yeargin</xbar.author>
# <xbar.author.github>stephenyeargin</xbar.author.github>
# <xbar.desc>Show a StatusPage.io's Status in BitBar</xbar.desc>
# <xbar.dependencies>ruby</xbar.dependencies>
# <xbar.image>http://i.imgur.com/FsD4zDD.png</xbar.image>
@benschweizer
benschweizer / ocr
Last active August 24, 2022 08:13
create transcripts from screenshots
#!/bin/bash
#
for F in ~/Desktop/screenshots/*.png; do
>&2 echo -n .
FN="${F%.*}"
test -f "$FN.txt" && continue
echo "$FN"
done | parallel -j8 'tesseract {}.png {} -l deu+eng > /dev/null 2>&1 && echo -n "+"'
@benschweizer
benschweizer / ifwatch
Last active November 19, 2021 16:25
watchdog checking network interface
#!/bin/bash
#
# watchdog checking network interface
if [ $# -ne 1 ]; then
cat <<HERE
usage:
ifwatch eth0
HERE
exit 1
@benschweizer
benschweizer / site.yml
Created July 14, 2020 12:31
ansible roles from inventory vars
---
- hosts: site
become: yes
gather_facts: no
tasks:
- name: Running role {{ role }}
include_role:
name: "{{ role }}"
loop: "{{ roles_to_apply }}"
@benschweizer
benschweizer / code
Last active September 22, 2023 15:37
open file in vscode remote ssh from a different terminal
#!/bin/bash
set -e
set -o pipefail
PID=$(lsof -w -c node | grep vscode-ipc | sed -e 's/ */ /g' | cut -d " " -f2 | head -1)
NODE=$(readlink -f /proc/$PID/exe)
CODE=$(dirname $NODE)/bin/remote-cli/code
SOCK=$(lsof -w -c node | grep vscode-ipc | sed -e 's/ */ /g' | cut -d " " -f9 | head -1)