Skip to content

Instantly share code, notes, and snippets.

View peter279k's full-sized avatar
🎯
Focusing

Chun-Sheng, Li peter279k

🎯
Focusing
View GitHub Profile
@peter279k
peter279k / install-xrdp-ubuntu-18.04.md
Created July 3, 2021 16:05 — forked from hehuan2112/install-xrdp-ubuntu-18.04.md
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
peter279k / upgrade_apache.sh
Created June 27, 2020 19:27
This is about upgrading Apache server on Ubuntu 16.04 and Ubuntu 18.04
#!/bin/bash
# References:
# https://www.mysterydata.com/update-apache-2-4-to-latest-version-on-ubuntu-16-04-server-vestacp/
sudo_prefix="sudo "
if [[ ${USER} == "root" ]]; then
sudo_prefix=""
else
@peter279k
peter279k / encrypt_password.py
Created February 22, 2024 06:38 — forked from jkatz/encrypt_password.py
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
peter279k / apache2_HPKP.md
Created January 25, 2024 14:03 — forked from GAS85/apache2_HPKP.md
Activating HTTP Public Key Pinning (HPKP) on Let's Encrypt

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

Source: https://lilleengen.io/blog/index.php/posts/activating-http-public-key-pinning-hpkp-on-lets-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
peter279k / docker_installer.sh
Last active December 7, 2023 12:13
This is a Docker (docker-ce) installation for Ubuntu 16.04 and Ubuntu 18.04
#!/bin/bash
# This bash script is referenced by https://www.hostinger.com/tutorials/how-to-install-docker-on-ubuntu
# Reference: https://docs.docker.com/engine/install/ubuntu/
echo 'Check your Linux Distribution....'
which lsb_release > /dev/null 2>&1
if [[ $? != 0 ]]; then
@peter279k
peter279k / gen-key-script
Created December 6, 2023 07:53 — forked from woods/gen-key-script
Creating gpg keys non-interactively
Key-Type: 1
Key-Length: 2048
Subkey-Type: 1
Subkey-Length: 2048
Name-Real: Root Superuser
Name-Email: root@handbook.westarete.com
Expire-Date: 0
@peter279k
peter279k / facebook_login.py
Last active October 23, 2023 07:36 — forked from UndergroundLabs/gist:fad38205068ffb904685
Facebook Python Login Script
#!/home/drspock/scripts/FBInvite/bin/python
import argparse
import requests
import pyquery
def login(session, email, password):
'''
Attempt to login to Facebook. Returns user ID, xs token and
@peter279k
peter279k / frp systemd.md
Created March 18, 2023 15:43 — forked from ihipop/frp systemd.md
FRP systemd 启动脚本 FRP systemd init config