Skip to content

Instantly share code, notes, and snippets.

sudo su - // convert to root
ps auwx | grep nginx // check nginx run status
gcloud compute instances create gcelab2 --machine-type n1-standard-2 --zone us-central1-f
gcloud compute ssh gcelab2 --zone us-central1-f
gcloud compute instances get-serial-port-output instance-1 //check whether the server is ready for an RDP connection
gcloud compute reset-windows-password [instance] --zone us-central1-a --user [username]
@tingwei628
tingwei628 / riscv_hello_world.txt
Last active June 8, 2021 13:40
edx_RiscV_on_Linux_HelloWorld
-----code-----
# Simple RISC-V Hello World
.global _start
_start: addi a0, x0, 1
la a1, helloworld
addi a2, x0, 13
addi a7, x0, 64
ecall
@tingwei628
tingwei628 / README.md
Created May 20, 2021 05:00 — forked from dims/README.md
Kubernetes Resources
@tingwei628
tingwei628 / compiler_in_csharp_repos.md
Last active September 27, 2024 03:52
compiler in csharp repos
@tingwei628
tingwei628 / debugging_csharp_extension_vscode.md
Last active April 1, 2021 10:49
Debugging C# extension in VSCode

NOTE

If your dotnet.exe is NOT in C:\Program Files\dotnet\dotnet.exe

This extension is called "C# for Visual Studio Code (powered by OmniSharp)"

Step 1

In settings.json (File -> Preferences -> Settings)

{
  "omnisharp.path": "latest"
}
@tingwei628
tingwei628 / template.js
Created March 26, 2021 13:48
kick start/code jam JavaScript template
//Run node app.js < input.txt
function readInput() {
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
let problem = {
@tingwei628
tingwei628 / update-git.sh
Created February 6, 2021 04:28 — forked from YuMS/update-git.sh
Update git to latest version on Ubuntu
#!/bin/bash
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git -y
@tingwei628
tingwei628 / Dockerfile
Created February 1, 2021 05:59 — forked from angeloskaltsikis/Dockerfile
A wrapper to make Terragrunt less verbose (both plan & apply supported). Also includes all the files required to efficiently run Terragrunt with Atlantis.
ARG atlantis_version=v0.15.0
FROM runatlantis/atlantis:${atlantis_version}
LABEL maintainer="Beat DevOps Team"
LABEL description="thebeat.co atlantis image used in IaC CI/CD!"
LABEL version="0.2"
# https://github.com/gruntwork-io/terragrunt/releases
ARG terragrunt_version=v0.25.1
@tingwei628
tingwei628 / ZipRollingFileAppender.cs
Created November 11, 2020 07:14
archieve files after rolling append log in log4net
public class ZipFileAppender : log4net.Appender.RollingFileAppender
{
protected override void AdjustFileBeforeAppend()
{
var currentFile = File;
long max = 10485760; // 10MB
System.IO.FileInfo fa = new System.IO.FileInfo(currentFile);
if (fa.Length >= max)