Skip to content

Instantly share code, notes, and snippets.

(gci C:\Users -r | ? {$_.PSIsContainer -eq $True}) | ? {$_.GetFiles().Count + $_.GetDirectories().Count -eq 0} | select FullName
@xuyang2
xuyang2 / install-graphite-ubuntu-12.04.sh
Created December 4, 2015 05:40 — forked from jgeurts/install-graphite-ubuntu-12.04.sh
Install Graphite 0.9.10 on Ubuntu 12.04
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
cd
sudo apt-get update
sudo apt-get upgrade
@xuyang2
xuyang2 / statuses.md
Created August 17, 2016 11:05 — forked from vkostyukov/statuses.md
HTTP status codes used by world-famous APIs
API Status Codes
[Twitter][tw] 200, 304, 400, 401, 403, 404, 406, 410, 420, 422, 429, 500, 502, 503, 504
[Stripe][stripe] 200, 400, 401, 402, 404, 429, 500, 502, 503, 504
[Github][gh] 200, 400, 422, 301, 302, 304, 307, 401, 403
[Pagerduty][pd] 200, 201, 204, 400, 401, 403, 404, 408, 500
[NewRelic Plugins][nr] 200, 400, 403, 404, 405, 413, 500, 502, 503, 503
[Etsy][etsy] 200, 201, 400, 403, 404, 500, 503
[Dropbox][db] 200, 400, 401, 403, 404, 405, 429, 503, 507
@xuyang2
xuyang2 / phpunzip.php
Created May 10, 2017 09:32 — forked from samwhelp/phpunzip.php
PHP ZIP 解壓縮,檔名編碼自動轉為Utf-8編碼範例
#!/usr/bin/env php
<?php
/**
* PHP ZIP 解壓縮,檔名編碼自動轉為Utf-8編碼範例。
*
* @see https://gist.github.com/samwhelp/2f6764561bc3b5f15125
* @see http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=327124#forumpost327124
* @see http://micy.cn/blog/post/118
* @see http://www.chengcms.com/study/391.html?jdfwkey=wtgln3
* @see http://forum.ubuntu.org.cn/viewtopic.php?f=163&t=325386
@xuyang2
xuyang2 / main.go
Created May 15, 2018 12:33 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
bool
create_process_as_login_user(
_In_ const wchar_t* cmdline
)
{
_ASSERTE(NULL != cmdline);
if (NULL == cmdline) return false;
DWORD session_id = WTSGetActiveConsoleSessionId();
DWORD explorer_pid = 0xFFFFFFFF;
@xuyang2
xuyang2 / curl.md
Created August 10, 2018 01:29 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@xuyang2
xuyang2 / win_subprocess.py
Created January 18, 2019 13:07 — forked from vaab/win_subprocess.py
Fixing python 2.7 windows unicode issue with ``subprocess.Popen``.
## issue: https://bugs.python.org/issue19264
import ctypes
import subprocess
import _subprocess
from ctypes import byref, windll, c_char_p, c_wchar_p, c_void_p, \
Structure, sizeof, c_wchar, WinError
from ctypes.wintypes import BYTE, WORD, LPWSTR, BOOL, DWORD, LPVOID, \
HANDLE
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip
# Unzip
unzip protoc-3.5.1-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
@xuyang2
xuyang2 / latest-protobuf-ubuntu-18-04.md
Created July 16, 2019 12:00 — forked from diegopacheco/latest-protobuf-ubuntu-18-04.md
How to Install Latest Protobuf on Ubuntu 18.04
sudo apt-get install autoconf automake libtool curl make g++ unzip -y
git clone https://github.com/google/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
make
make check
sudo make install
sudo ldconfig