Skip to content

Instantly share code, notes, and snippets.

@scyto
scyto / proxmox.md
Last active May 17, 2024 17:52
proxmox cluster proof of concept

ProxMox Cluster - Soup-to-Nutz

aka what i did to get from nothing to done.

note: these are designed to be primarily a re-install guide for myself (writing things down helps me memorize the knowledge), as such don't take any of this on blind faith - some areas are well tested and the docs are very robust, some items, less so). YMMV

Purpose of Proxmox cluster project

Required Outomces of cluster project

@Salamafet
Salamafet / check_certificate.sh
Created August 30, 2022 12:26
Gotify notification when certificate expire
#!/bin/bash
certificat=/usr/certificate/example.com/cert.pem
gotify_url="https://push.example.com/message?token=xxxxx"
gotify_title="Synology Certificate Expiry"
function check_certificat () {
if openssl x509 -checkend $((${1}*86400)) -noout -in $certificat; then
return 1
else

1. 如何確認自己是使用Wayland工作階段

使用echo $XDG_SESSION_TYPE即可得知是x11還是wayland

KDE登入畫面SDDM左下角點選Plasama (Wayland)工作階段

GNOME 42後已預設使用GNOME,登入時GDM右下角齒輪會有GNOMEGNOME on Xorg的選項。

2. 強制瀏覽器使用純Wayland工作階段

@jrsmith3
jrsmith3 / doi2bib.py
Last active May 17, 2024 17:43
Python method to access crossref.org DOI bibtex metadata resolver
import requests
def doi2bib(doi):
"""
Return a bibTeX string of metadata for a given DOI.
"""
url = "http://dx.doi.org/" + doi
headers = {"accept": "application/x-bibtex"}
@n1snt
n1snt / Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md
Last active May 17, 2024 17:42
Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@simonw
simonw / recover_source_code.md
Last active May 17, 2024 17:42
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@iMerica
iMerica / viscosity-to-ios-connect.rb
Last active May 17, 2024 17:39 — forked from chrisboulton/viscosity-to-ios-connect.rb
Quickly convert all of your Viscosity connections into OVPN configuration files for OpenVPN for iOS (bundles certificates and keys in the files too)
Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf").each do |file|
certificate_files = ['ca', 'cert', 'key', 'tls-auth']
config_dir = File.dirname(file)
connection_name = nil
new_config = []
File.read(file).lines.each do |line|
line.strip!
if line.start_with?('#viscosity name')
@fishi0x01
fishi0x01 / baseURL.groovy
Last active May 17, 2024 17:38
This is a collection of groovy scripts I gathered and use for bootstrapping Jenkins. Most of this can also be achieved with the CasC Plugin https://github.com/jenkinsci/configuration-as-code-plugin
#!groovy
/*
* This script configures the Jenkins base URL.
*/
import jenkins.model.JenkinsLocationConfiguration
JenkinsLocationConfiguration location = Jenkins.instance.getExtensionList('jenkins.model.JenkinsLocationConfiguration')[0]
location.url = 'https://jenkins-as-code-poc.devtail.io/'
@balazsorban44
balazsorban44 / apple-gen-secret.mjs
Created November 27, 2021 13:08
Script to generate Apple Client secret
#!/bin/node
import { SignJWT } from "jose"
import { createPrivateKey } from "crypto"
if (process.argv.includes("--help") || process.argv.includes("-h")) {
console.log(`
Creates a JWT from the components found at Apple.
By default, the JWT has a 6 months expiry date.
Read more: https://developer.apple.com/documentation/sign_in_with_apple/generate_and_validate_tokens#3262048