Skip to content

Instantly share code, notes, and snippets.

Write-Host "Creating necessary user account"
$pw = ConvertTo-SecureString -String "sshd_password" -AsPlainText -Force
New-LocalUser -Name sshd -Password $pw -PasswordNeverExpires -AccountNeverExpires
Add-LocalGroupMember -Group Administrators -Member sshd
Write-Host "Installing Cygwin"
Invoke-WebRequest https://cygwin.com/setup-x86_64.exe -OutFile C:\setup-x86_64.exe
Start-Process C:\setup-x86_64.exe -Wait -NoNewWindow -ArgumentList "-q -n -l C:\cygwin64\packages -s http://mirrors.kernel.org/sourceware/cygwin/ -R C:\cygwin64 -P python-devel,openssh,cygrunsrv,wget,tar,qawk,bzip2,subversion,vim,make,gcc-fortran,gcc-g++,gcc-core,make,openssl,openssl-devel,libffi-devel,libyaml-devel,git,zip,unzip,gdb,libsasl2,gettext"
Remove-Item C:\setup-x86_64.exe
@li-wu
li-wu / openssl_example.cpp
Last active September 28, 2022 07:44
Example for signing message with private key and validation with public key with OpenSSL 3.0
// This gist is taken from https://gist.github.com/irbull/08339ddcd5686f509e9826964b17bb59 with changes to migrate to OpenSSL 3.0
#include <iostream>
#include <openssl/aes.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
yum install -y yum-utils
yum install -y nfs-utils
yum install -y socat
yum install -y conntrack-tools
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
systemctl start docker
systemctl enable docker
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: flannel
rules:
- apiGroups:
- ""
resources:
- pods
@li-wu
li-wu / handle_file.js
Created December 24, 2018 06:58
Using koa to handle file upload
const fs = require('fs')
const app = new Koa()
const router = new Router()
const serve = require('koa-static')
const koaBody = require('koa-body')
app
.use(serve(__dirname + '/files')) // files文件夹用于保存上传的文件,也是静态资源地址
.use(router.routes())
apiVersion: v1
kind: Namespace
metadata:
name: production
apiVersion: v1
kind: Namespace
metadata:
name: development