Skip to content

Instantly share code, notes, and snippets.

View 4ndrej's full-sized avatar

Andrej 4ndrej

View GitHub Profile
@4ndrej
4ndrej / gist:6d58f2e9a77e1aa2581d21e39b4411d9
Created November 14, 2018 09:34
sublimetext ebook merge paragraphs regexp pattern
sublimetext ebook merge paragraphs regexp pattern
search pattern:
(\n\n)([\w])
replace pattern:
\2
before:
„Elfové a draci, řek jsem svýmu klukovi, zelí a brambory jsou pro nás
@4ndrej
4ndrej / Test.java
Created October 14, 2019 20:56 — forked from nogweii/Test.java
A quick test to see if you have the JCE Unlimited Strength Jurisdiction Policy files installed. If you don't, in Java 6 you'll see 128. If you do, you'll see 2147483647. Thanks to http://stackoverflow.com/questions/11538746/check-for-jce-unlimited-strength-jurisdiction-policy-files
import javax.crypto.Cipher;
class Test {
public static void main(String[] args) {
try {
System.out.println("Hello World!");
int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
System.out.println(maxKeyLen);
} catch (Exception e){
System.out.println("Sad world :(");
@4ndrej
4ndrej / nginx.conf
Created August 14, 2020 13:51
nginx yyyy-mm logging without if
http {
#access_log logs/access.log main;
# parse \d{4}-\d{2} from $time_iso8601 into $yyyy_mm
map $time_iso8601 $yyyy_mm {
"~^(?<temp>\d{4}-\d{2})" $temp;
}
server {
listen 80;
@4ndrej
4ndrej / certbot-authhook-az-cli-annotated.sh
Created September 1, 2020 23:28 — forked from colindekker/certbot-authhook-az-cli-annotated.sh
CertBot manual auth hook for Azure DNS using Azure CLI
#!/bin/bash
# The hook supports 2 actions, 'create' and 'delete', passed as the first argument.
# When 'create' is passed in, a validation TXT record is added,
# 'delete' cleans up that record after validation
ACTION=$1
# The second the name of the Azure Account that contains the DNS Zone Resource
AZ_ACCOUNT=$2
echo $AZ_ACCOUNT
# set the name of the Azure Resource Group that contains the DNS Zone Resource
@4ndrej
4ndrej / ford-m.js
Created January 31, 2023 16:02
ford radio code generator
// radio code generator for ford radio with serial starting with "M"
// stolen from https://github.com/OlegSmelov/ford-radio-codes
// get the radio serial by holding 1+6 while powering radio on
'use strict';
function generateSerial(serial) {
const lookup = [
[9, 5, 3, 4, 8, 7, 2, 6, 1, 0],
[2, 1, 5, 6, 9, 3, 7, 0, 4, 8],
@4ndrej
4ndrej / thestoryofus.sh
Created February 22, 2023 07:47 — forked from dirkjanfaber/thestoryofus.sh
Download the story of us as epub (waitbutwhy)
#/bin/bash
dir=$(mktemp --directory)
declare -a input=()
cat <<__EOT__ > ${dir}/metadata.txt
---
title: The Story of Us
author: Tim Urban
rights: Creative Commons Non-Commercial Share Alike 3.0