Skip to content

Instantly share code, notes, and snippets.

@hyang0
hyang0 / windows event logs cheat sheet
Created September 11, 2024 06:19 — forked from githubfoam/windows event logs cheat sheet
windows event logs cheat sheet
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# PS : ChatGPT makes mistakes, consider "trust but verify" principle
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#Events to Monitor
https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/plan/appendix-l--events-to-monitor
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#run
eventvwr.msc Event viewer
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Event Viewer(Local)-Windows Logs (shutdown / restart )
@hyang0
hyang0 / 0-go-os-arch.md
Created May 12, 2022 07:09 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@hyang0
hyang0 / tigervnconubuntu.md
Created April 6, 2022 08:08
Install tigervnc on Ubuntu

NOTE: Given its current state, I've given up on tigervnc and now rely on "ssh -X" to execute remote gui apps. As a result I won't be updating this gist any more, but will leave it up as a reference for others.

Installing TigerVNC on Ubuntu 18.04 LTS

This is for Ubuntu 18.04 LTS. TigerVNC is a remote desktop session server and viewer solution sponsored by Red Hat that is still in active development. While I recently tested under Ubuntu 19.10, I have no plans to test non-LTS versions in the future.

There are packages for TigerVNC in the repositories of the major distributions, but the latest versions for Ubuntu are broken. My workaround is to use the latest stable version from the TigerVNC project Github release page, where generic binaries for 32 and 64-bit Linux are distributed as tarballs (dmg and exe installers for Mac and Windows are also available).

NOTE: A key file is missing from the latest offici

@hyang0
hyang0 / netstat.py
Created March 31, 2022 01:53 — forked from abhi-bit/netstat.py
netstat in python
#!/usr/bin/python
import pwd
import os
import re
import glob
PROC_TCP = "/proc/net/tcp"
STATE = {
'01':'ESTABLISHED',
# mac 快捷键
option + space — Alfred
control + space — finder
command + option + d — hide dock
command + ` — switch between the same app’s window
command + tab — switch between all the apps
command + shift + q — logout current account
command + delete — delete file
command + delete + shift — empty recycling bin
@hyang0
hyang0 / setZh4msysgit.sh
Last active January 4, 2016 04:59
msysgit 中文乱码解决方案
#!/bin/sh
# 中文编码支持
echo "export LESSCHARSET=utf-8" > $HOME/.profile
git config --global gui.encoding utf-8
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
git config --global core.quotepath false
# 别名设置
@hyang0
hyang0 / vim_encoding_utf8
Created January 23, 2014 03:50
vim encoding utf-8
: write ++enc=utf-8
@hyang0
hyang0 / vim_command
Created January 23, 2014 03:45
vim: convert tab to space
: setlocal et sta sw=4 sts=4 expandtab
: ret!
@hyang0
hyang0 / xstartup
Created October 15, 2013 04:22
vnc4server xstartup script
#!/bin/sh
release_number=`lsb_release -r|cut -f 2`
if [ $release_number = "12.04" ]; then
# Please install gnome-session-fallback at first
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
gnome-session --session=gnome-classic &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
@hyang0
hyang0 / sql_tips.sql
Last active October 21, 2015 00:25
oracle sql functions
-- 取倒数第二位
select to_number(substr('12345', -2, 1)) from dual;
-- 正规匹配尾数为2,7的字符串
select example_str from example_table
where regexp_like(example_str, '.*[27]$');
-- 取日期(年-月-日)中的日
select to_number(to_char(sysdate, 'dd')) from dual;