This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set encoding=utf-8 | |
set fileencodings=utf-8 | |
"options | |
syntax on | |
set nocompatible | |
set shiftwidth=2 | |
set tabstop=2 | |
set expandtab | |
set backspace=2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/sites-available/default | |
# Default server configuration | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name _; | |
return 444; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create ssl automation | |
/opt/letsencrypt/certbot-auto certonly --agree-tos --webroot -w /srv/letsencrypt -d example.com -d www.example.com | |
# wildcard with dns | |
/opt/letsencrypt/certbot-auto certonly --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns -d *.example.com -d example.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# abc | |
# def | |
# ijk | |
# -> abc\ndef\nijk | |
# linux | |
sed ':a;N;$!ba;s/\n/\\\\n/g' file | |
# mac OSX | |
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\\\n/g' file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mode_map = { | |
"cpp": "c_cpp", | |
"java": "java", | |
"python":"python", | |
"python3": "python", | |
"bash": "sh", | |
"javascript": "javascript", | |
"css": "css", | |
"html": "html", | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## remove a path from PATH | |
function removeFromPath() { | |
export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;") | |
} | |
## set JAVA env with given version | |
function setJDK() { | |
if [ $# -ne 0 ]; then | |
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin' | |
if [ -n "${JAVA_HOME+x}" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"github.com/gorilla/mux" | |
) | |
func GetExampleHandler(text string) http.HandlerFunc { | |
return func(w http.ResponseWriter, r *http.Request) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type MockRouter struct { | |
mu sync.Mutex | |
r *mux.Router | |
} | |
func (mr *MockRouter) Swap(r *mux.Router) { | |
mr.mu.Lock() | |
mr.r = r | |
mr.mu.Unlock() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from Crypto.Cipher import AES | |
import base64 | |
import re | |
DEFAULT_KEY = 'anrxvpAAa9x5kEUm' | |
class AesCbc: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package parser; | |
import java.util.Map; | |
import java.util.HashMap; | |
import java.lang.reflect.Constructor; | |
public class ParserFactory { | |
private Map<String, Class<?>> classMap; | |
public ParserFactory() { | |
classMap = new HashMap<>(); |
NewerOlder