Skip to content

Instantly share code, notes, and snippets.

View yusiwen's full-sized avatar

Siwen Yu yusiwen

View GitHub Profile
@morhekil
morhekil / nginx.conf
Created August 14, 2014 12:18
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
@lloeki
lloeki / gist:62239da19ec25f90f215
Created December 16, 2014 16:15
open-vm-tools with clipboard and drag and drop on Ubuntu 14.04 Trusty Tahr
# You should be using open-vm-tools instead of vmware tools, because package manager.
# Also I hate third parties that write out of /opt and /usr/local.
# open-vm-tools-desktop is badly packaged though, here are the missing links:
sudo apt-get install open-vm-tools open-vm-tools-desktop
# Reboot, and resize works, but no DnD nor clipboard
sudo mkdir /var/run/vmblock-fuse
sudo su -l -c "vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permissions,allow_other /var/run/vmblock-fuse"
# Now we have /run/vmblock-fuse populated.
# Adding an upstart rule in /etc/init is left as an exercise to the reader.
@kevinmmarlow
kevinmmarlow / build.gradle
Created January 30, 2015 20:04
CheckStyle, FindBugs, and PMD in Gradle
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'pmd'
task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/path/to/checkstyle/config/checkstyle.xml") // Checkstyle config location
source 'src/main/java'
include '**/*.java'
exclude '**/gen/**'
@romainl
romainl / _rnb.md
Last active June 26, 2025 17:42
RNB, a Vim colorscheme template
@gonzaloserrano
gonzaloserrano / log.go
Created August 18, 2015 17:56
logrus wrapper
package log
import (
"fmt"
"github.com/Sirupsen/logrus"
"runtime"
"strings"
)
var logger = logrus.New()
@jtbonhomme
jtbonhomme / jira-behing-nginx-ssl
Created September 26, 2015 07:49 — forked from alertor/jira-behing-nginx-ssl
Atlassian JIRA behind nginx + SSL
# force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf
server {
listen 80;
server_name jira.example.com;
access_log off;
return 301 https://$server_name$request_uri;
}
# /etc/nginx/conf.d/jira.conf
server {
@ctechols
ctechols / compinit.zsh
Last active June 25, 2025 13:13
Speed up zsh compinit by only checking cache once a day.
# On slow systems, checking the cached .zcompdump file to see if it must be
# regenerated adds a noticable delay to zsh startup. This little hack restricts
# it to once a day. It should be pasted into your own completion file.
#
# The globbing is a little complicated here:
# - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct.
# - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error)
# - '.' matches "regular files"
# - 'mh+24' matches files (or directories or whatever) that are older than 24 hours.
autoload -Uz compinit
@billautomata
billautomata / ssh_tunnels.sh
Last active January 9, 2025 01:10
ssh port forwarding cheatsheet
# local port forwarding
# the target host 192.168.0.100 is running a service on port 8888
# and you want that service available on the localhost port 7777
ssh -L 7777:localhost:8888 [email protected]
# remote port forwarding
# you are running a service on localhost port 9999
# and you want that service available on the target host 192.168.0.100 port 12340
@evantoli
evantoli / GitConfigHttpProxy.md
Last active July 15, 2025 21:49
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@khlus
khlus / server.cpp
Last active September 24, 2023 13:47
Unix domain sockets + select + pthread
#include <stdio.h>
#include <stdint.h>
#include <string.h> //strlen
#include <stdlib.h>
#include <errno.h>
#include <unistd.h> //close
#include <sys/un.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>