Skip to content

Instantly share code, notes, and snippets.

@ws2356
ws2356 / .ignore
Created April 27, 2021 08:39 — forked from hereisderek/.ignore
my homebrew install list
dump.list
@ws2356
ws2356 / NavigationParallaxTransition.swift
Created January 18, 2021 08:12 — forked from stuartjmoore/NavigationParallaxTransition.swift
Re-create the Default `UINavigationController` Transition in iOS 10
//
// NavigationParallaxTransition.swift
// NavigationTransition
//
// Created by Stuart Moore on 2/12/17.
// Copyright © 2017 Stuart J. Moore. All rights reserved.
//
import UIKit
@ws2356
ws2356 / print256colours.sh
Created August 9, 2020 16:21 — forked from HaleTom/print256colours.sh
Print a 256-colour test pattern in the terminal
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256
@ws2356
ws2356 / async_result.cpp
Created June 14, 2020 04:48 — forked from inetic/async_result.cpp
Example usage of boost::asio::async_result
// Example of how to use boost::asio::async_result
#include <iostream>
#include <boost/asio.hpp>
#if BOOST_VERSION >= 106600
template<typename CompletionToken>
typename boost::asio::async_result
<CompletionToken, void(boost::system::error_code, std::string)>::return_type
@ws2356
ws2356 / rninit.sh
Last active December 10, 2019 01:09
generate and setup an ios project
#!/bin/bash
set -e
npx react-native init "$@"
POSITIONAL=()
while [ "$#" -gt 0 ] ; do
key="$1"
case $key in
@ws2356
ws2356 / send_email.py
Last active September 28, 2019 09:36
send email using python3 smtplib
#!/usr/bin/env python3
import os
import sys
import smtplib
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import COMMASPACE
SMTP_ADDR = 'smtp.office365.com'
@ws2356
ws2356 / uninstall_mac_app
Created September 5, 2019 05:25
bash script used to uninstall mac osx app and related config file
#!/usr/bin/env bash
set -e
app_name=$1
dry_run=${2:-false}
declare -a locations=(
/Applications
~/Library/Application\ Support
~/Library/Preferences
@ws2356
ws2356 / setup-ca.md
Created June 16, 2019 01:28
自建ca

1, CA证书

创建ca私钥

openssl genrsa -out ca.home.org.key 2048

创建ca自签名证书

openssl req -new -x509 -key ca.home.key -out ca.home.crt

查看

openssl req -in share.home.csr -noout -text

按照不同系统的方式,添加到信任的根证书

2, 用户证书

@ws2356
ws2356 / kubecp.sh
Created May 7, 2019 09:57
拷贝文件到多个匹配的pod的对应位置
#!/usr/bin/env bash
set -e
ff=$1
pat=${2:-apollon-backend}
di=$(dirname $ff)
function kube {
kubectl --kubeconfig=$HOME/Downloads/wansong.kubeconfig -n c-dev "$@"
@ws2356
ws2356 / create_init_db.sql
Created May 5, 2019 13:00
后端项目初始化数据库
create user iapsync with encrypted password 'iapsync';
create database iapsync_db;
GRANT CONNECT ON DATABASE iapsync_db TO iapsync;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO iapsync;