Skip to content

Instantly share code, notes, and snippets.

View ChenTanyi's full-sized avatar

Tanyi Chen ChenTanyi

View GitHub Profile
@ChenTanyi
ChenTanyi / config.json
Last active May 10, 2024 20:56
Simple script to use tun2socks in windows, route all packets into socks5 server
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"listen": "0.0.0.0",
"port": 1080,
"protocol": "socks",
"settings": {
@ChenTanyi
ChenTanyi / httpclient.cs
Created September 10, 2021 07:40
debug http client of c#
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace test
{
public class HttpClientFactory : IHttpClientFactory
{
#!/bin/bash
set -e
# Simply create an Azure Web App with qBittorrent (only can download due to incoming TCP/UDP connection would be blocked)
RESOURCE_GROUP=""
APPSERVICE_PLAN=""
WEBAPP=""
STORAGE_ACCOUNT=""
#!/usr/bin/env python3
import os
import sys
import logging
def main():
pass
if __name__ == '__main__':
logging.basicConfig(

GPG key server

link

hkp://pgp.mit.edu:80
hkps://pgp.mit.edu
hkps://keyserver.ubuntu.com
hkp://p80.pool.sks-keyservers.net:80
hkps://hkps.pool.sks-keyservers.net (dried up)

Usage (Open connect as example)

$include /etc/inputrc
set completion-ignore-case On
azureexport() {
if [[ $# < 2 ]]; then
echo "export <key> <env_key>"
return
fi
export $2=`python -c 'import os, json, sys; print(json.load(open(os.environ["AZURE_AUTH_LOCATION"]))[sys.argv[1]])' $1`
}
azureexportall() {
azureexport clientId AZURE_CLIENT_ID
@ChenTanyi
ChenTanyi / derived.cpp
Created July 29, 2020 08:32
Derived class implement multi base function with same name but different type
#include <bits/stdc++.h>
struct A1 {
virtual void a1() = 0;
};
struct A2 {
virtual void a2() = 0;
};
@ChenTanyi
ChenTanyi / git-prompt.sh
Created May 14, 2020 08:27
/etc/profile.d/git-prompt.sh
PS1="$PS1"'\[\033[31m\]' # change to light red
PS1="$PS1"' \t' # time
@ChenTanyi
ChenTanyi / .bashrc
Last active October 11, 2021 12:33
#!/bin/bash
parse_git_branch() {
branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'`
if [[ ! -z "$branch" ]]; then
printf " $branch"
fi
}
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h \[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch) \[\033[01;35m\]\t\[\033[00m\]\$ '