Skip to content

Instantly share code, notes, and snippets.

weshouman /
Created April 11, 2024 17:02 — forked from briansmith/
How to generate & use private keys using the OpenSSL command line tool

How to Generate & Use Private Keys using OpenSSL's Command Line Tool

These commands generate and use private keys in unencrypted binary (not Base64 “PEM”) PKCS#8 format. The PKCS#8 format is used here because it is the most interoperable format when dealing with software that isn't based on OpenSSL.

OpenSSL has a variety of commands that can be used to operate on private key files, some of which are specific to RSA (e.g. openssl rsa and openssl genrsa) or which have other limitations. Here we always use

weshouman /
Last active July 28, 2022 05:08 — forked from vlasenkov/
win32com multithreading example
# win32com multithreading example
import sys
import time
from threading import Thread
# sys.coinit_flags has to be set before importing pythoncom and win32com, otherwise the following errors would be showing up
# - The application called an interface that was marshalled for a different thread.
# - This COM object can not automate the makepy process - please run makepy manually for this object
sys.coinit_flags = 0  # pythoncom.COINIT_MULTITHREADED == 0
weshouman / VS16NoTelem.bat
Created April 28, 2022 16:55
Disable telemetry in Visual Studio 2019
@echo off
fltmc >nul 2>&1 || (
echo This batch script requires administrator privileges. Right-click on
echo the script and select "Run as administrator".
goto :die
rem Change this path if you are using Community or Professional editions
set "VS_INSTALL_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise"
wget -O /tmp/
unzip /tmp/
sudo mkdir -p /usr/share/fonts/consolas
sudo mv YaHei.Consolas.1.12.ttf /usr/share/fonts/consolas/
sudo chmod 644 /usr/share/fonts/consolas/YaHei.Consolas.1.12.ttf
cd /usr/share/fonts/consolas
sudo mkfontscale && sudo mkfontdir && sudo fc-cache -fv
weshouman /
Created June 9, 2021 07:40 — forked from kennethreitz/
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = ''
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
weshouman /
Created November 29, 2020 19:17 — forked from amatelin/
A simple script to automatically downsize all the images in a folder using Gimp python console (Gimp->Filters/Python-Fu/console).
from os import listdir
from os.path import isfile, join
## Set image folder path
dir_path = "C:/img_dir/"
## Store files names in folder
files = [f for f in listdir(dir_path) if isfile(join(dir_path, f))]
for file in files:
weshouman / kube-registry.yaml
Last active June 10, 2020 12:33 — forked from coco98/kube-registry.yaml
Docker registry on a cluster
apiVersion: v1
kind: ReplicationController
name: kube-registry-v0
namespace: kube-system
k8s-app: kube-registry
version: v0
replicas: 1
weshouman / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console