Skip to content

Instantly share code, notes, and snippets.

View peter279k's full-sized avatar

Chun-Sheng, Li peter279k

View GitHub Profile
peter279k /
Created February 22, 2024 06:38 — forked from jkatz/
Methods to create password verifiers for PostgreSQL
# Copyright 2019-2022 Jonathan S. Katz
# MIT License
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
peter279k /
Created January 25, 2024 14:03 — forked from GAS85/
Activating HTTP Public Key Pinning (HPKP) on Let's Encrypt

Activating HTTP Public Key Pinning (HPKP) on Let's Encrypt


  • Disclaimer: This might break your website, don't preceded if you don't know what you're doing.

Since the letsencrypt seems to create a new private key every time the certificate is renewed and Let's Encrypt requires you to renew you certificate once every ~80 days pinning using your certificate's SPKI is probably not the way to go. So, what should we pin then? Let's Encrypt is currently issuing from Authority X3, and using Authority X4 as a backup, so these two is a great place to start. We should also include the ISRG Root so this might support new Authorities with other SPKIs as well.

Generate HASH of Private Keys

To generate the hash of the SPKI of these certificates run the following commands

peter279k / gen-key-script
Created December 6, 2023 07:53 — forked from woods/gen-key-script
Creating gpg keys non-interactively
View gen-key-script
Key-Type: 1
Key-Length: 2048
Subkey-Type: 1
Subkey-Length: 2048
Name-Real: Root Superuser
Expire-Date: 0
peter279k / frp
Created March 18, 2023 15:43 — forked from ihipop/frp
FRP systemd 启动脚本 FRP systemd init config
View frp
peter279k /
Created December 16, 2022 14:09 — forked from yanqd0/
Python requests download file with a tqdm progress bar
import requests
from tqdm import tqdm
def download(url: str, fname: str, chunk_size=1024):
resp = requests.get(url, stream=True)
total = int(resp.headers.get('content-length', 0))
with open(fname, 'wb') as file, tqdm(
View build.yml
name: build
on: [ push, pull_request ]
runs-on: ${{ matrix.operating-system }}
operating-system: [ ubuntu-latest ]
peter279k / curl_progress.php
Created April 26, 2022 13:48 — forked from bdunogier/curl_progress.php
PHP/cURL download progress monitoring
View curl_progress.php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( '' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );
peter279k /
Created November 30, 2021 03:03 — forked from mrcomoraes/
Clear cache Microsoft Teams on Linux
# This script cleans all cache for Microsoft Teams on Linux
# Tested on Ubuntu-like and Debian by @necrifede. Feel free to test/use in other distributions.
# Tested with Teams via snap package.
# How to use in terminal:
# ./ ( deb-stable | deb-insider | snap )
# or
# bash ( deb-stable | deb-insider | snap )
peter279k /
Created July 3, 2021 16:05 — forked from hehuan2112/
Install Remote Desktop (xRDP) for Ubuntu Server 18.04

Install Remote Desktop (xRDP) for Ubuntu Server 18.04

Step 1 – Install xRDP:

sudo apt update
sudo apt install xrdp

Step 2 – Install XFCE4

sudo apt install xfce4

peter279k / download.php
Created April 9, 2021 17:43 — forked from beyerz/download.php
Symfony console, download remote file with progress bar using guzzle
View download.php
* @param SymfonyStyle $io
* @param $remotePath
* @return string
public function download(SymfonyStyle $io, $remotePath)
$io->section("Download " . $remotePath);
$parts = parse_url($remotePath);