Skip to content

Instantly share code, notes, and snippets.

@jk
jk / !README.md
Created April 22, 2024 09:02
Generate IPv6 address from IPv6 prefix and interface's MAC address

Generate IPv6 address from IPv6 prefix and interface's MAC address

More or less like what SLAAC is doing, but without relying on the router advertisment.

Installation

pip install netifaces
@jk
jk / kagi-summarizer-bookmarklet.js
Created February 12, 2023 12:23
Kagi Universal Summarizer Bookmarklet for every Browser that supports it
javascript:q=location.href;if(document.getSelection){d=document.getSelection();}else{d='';};p=document.title;void(open('https://labs.kagi.com/ai/sum?url='+encodeURIComponent(q),'Kagi Universal Summarizer','toolbar=no,width=710,height=685'));
@jk
jk / trait.properties.php
Created July 7, 2012 13:49
Example of PHP traits to implement real properties in PHP classes
<?php
/**
* Real properties PHP trait
* Requirements: PHP 5.4 or later
*/
trait Properties
{
protected $properties;
public function __get($name)
@jk
jk / keybase.md
Created July 5, 2023 19:09
keybase.md

Keybase proof

I hereby claim:

  • I am jk on github.
  • I am jenskohl (https://keybase.io/jenskohl) on keybase.
  • I have a public key ASCJQngNFVFpJ0E9EF6huIW-XMK7ylP7mUlcTa0jMKgpbAo

To claim this, I am signing this object:

@jk
jk / sodium.php
Created March 16, 2021 14:06
Sodium Test
<?php
if (sodium_crypto_aead_aes256gcm_is_available()) {
echo 'sodium_crypto_aead_aes256gcm_is_available is true'.PHP_EOL;
} else {
echo 'sodium_crypto_aead_aes256gcm_is_available is false'.PHP_EOL;
}
//echo 'Generated key with sodium_crypto_aead_aes256gcm_keygen is: ' . sodium_crypto_aead_aes256gcm_keygen() . PHP_EOL;
$msg = 'john.doe@example.com';
@jk
jk / generate_passkit_manifest.sh
Created June 28, 2012 09:27
Generate PassKit manifest.json
echo "{"`find . -type f -exec shasum {} + | sed 's/\.\///g' | awk '{print "\t\"" $2 "\" : \"" $1 "\","}' | grep -v -E "(\.DS_Store|manifest\.json)"`"}" | sed 's/\,}/}/g' | python -mjson.tool > manifest.json
# -*- coding: utf-8 -*-
"""Test using the InfluxDB client."""
import time
import colorsys
import os
import sys
import socket
import ST7735
import ltr559
@jk
jk / docker-compose.yml
Created May 25, 2022 11:12
Traefik docker-compose network settings
version: '3.8'
services:
traefik:
image: traefik:v2.5.0-rc2
container_name: traefik
restart: always
environment:
- TZ=Asia/Taipei
ports:
@jk
jk / PHP+RestServer.language
Created August 16, 2011 13:34
Extended TextMate PHP language for supporting RestServer.php notation
{ scopeName = 'source.php';
comment = "TODO:
• Try to improve parameters list syntax – scope numbers, ‘=’, ‘,’ and possibly be intelligent about entity ordering
• Is meta.function-call the correct scope? I've added it to my theme but by default it's not highlighted";
firstLineMatch = '^#!.*(?<!-)php[0-9]{0,1}\b';
foldingStartMarker = '(/\*|\{\s*$|<<<HTML)';
foldingStopMarker = '(\*/|^\s*\}|^HTML;)';
patterns = (
{ comment = 'Matches empty tags.';
match = '(?x)
@jk
jk / regex.txt
Created September 14, 2021 12:05
YouTrack Issue Number RegEx
/\b[A-Z_0-9]+-[1-9]\d?\b/gmi