Skip to content

Instantly share code, notes, and snippets.

@tomac4t
tomac4t / upload-release-assets.py
Last active January 17, 2023 01:16
A python script to upload the release assets via the GitHub Release API.
#!/usr/bin/python3
# A python script to upload the release assets via the GitHub Release API.
import mimetypes
import os
import requests
import sys
# Written for Github actions when release created event is triggered.
# It must set the env variables in the GitHub actions file:
# env:
@tomac4t
tomac4t / keepassxc-build.sh
Last active July 9, 2020 03:30
Building KeePassXC
#!/bin/sh
set -ex
# Get the new version
Version=`curl -sf 'https://api.github.com/repos/keepassxreboot/keepassxc/releases/latest' | python -c "import sys, json; print json.load(sys.stdin)['tag_name']"`;
curl -Lf --proxy socks5://127.0.0.1:1080 "https://github.com/keepassxreboot/keepassxc/releases/download/"$Version"/keepassxc-"$Version"-src.tar.xz" | tar -Jxv;
cd keepassxc-$Version;
unset Version;
if [ -d "build" ]; then
rm -rf build;
fi
@tomac4t
tomac4t / GoogleRecaptchaConnectivity.js
Last active January 30, 2020 14:15
Google Connectivity Check
var connectivityFirstCheck = true;
var connectivityTestPassed;
// https://github.com/SukkaW/DisqusJS/blob/master/src/disqus.js#L235
const connectivityCheck = () => {
connectivityFirstCheck = false;
const img = new Image;
const timeout = setTimeout(() => {
img.onerror = img.onload = null;
connectivityTestPassed = false;