Skip to content

Instantly share code, notes, and snippets.

View johzzy's full-sized avatar

johzzy

  • Beijing
View GitHub Profile
@johzzy
johzzy / how-to-install-openssl-1.1.1-on-centos-7.md
Created February 14, 2022 07:45
How to install openssl 1.1.1 on CentOS 7

How To Install OpenSSL 1.1.1 on CentOS 7

This tutorial goes through how to install openssl 1.1.1 on CentOS 7, since the yum repo only installs up to openssl 1.0.

Requirements

Upgrade the system

yum -y update
@johzzy
johzzy / wsl2.ps1
Last active July 23, 2020 02:15
wsl2 hosts generator
# check wsl running
wslconfig /l /running
if ($LASTEXITCODE -ne 0) {
echo "Please open WSL before RUN 'sudo wsl2.ps1'."
exit;
}
# [Config]
$wsl_hosts = "wsl.local"
$win_hosts = "win.local"
struct generator {
using array = std::vector<int>;
static array gen(int num) {
array primes{2};
array visited(num, 0);
for (int i=3; i<num; i+=2) {
if (visited[i] == 0 && i % primes.back() != 0) {
primes.push_back(i);
for (int n=i; n<num; n+=i) {
visited[n] = 1;
function ydlplay($url) {
$(youtube-dl -g $url) | ForEach-Object { ffplay -hide_banner $_ }
}
@johzzy
johzzy / webcam-cv2.py
Last active July 8, 2019 06:02 — forked from tedmiston/webcam-cv2.py
Display the webcam in Python using OpenCV (cv2)
"""
Simply display the contents of the webcam with optional mirroring using OpenCV
via the new Pythonic cv2 interface. Press <esc> to quit.
"""
import cv2
def show(img):
ret, thresh1 = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY)
@johzzy
johzzy / Business after reinstalling Windows.md
Last active October 30, 2018 02:37 — forked from imba-tjd/.Windows Optimization.md
重装系统后要做的事以及一些配置文件
#coding = utf-8
from selenium import webdriver
fp = webdriver.FirefoxProfile('C:/Users/XXX/AppData/Roaming/Mozilla/Firefox/Profiles/i4g2sert.default')
driver = webdriver.Firefox(fp)
# 或 driver = webdriver.Firefox()
driver.get("https://www.bing.com")
print "hello"
driver.close()