Skip to content

Instantly share code, notes, and snippets.

View sonywork's full-sized avatar
🏠
Working from home

Sony Yang sonywork

🏠
Working from home
View GitHub Profile
@sonywork
sonywork / mongod.conf.mmapv1
Created April 6, 2020 02:08 — forked from spelcaster/mongod.conf.mmapv1
Scripts to configure a mongodb environment
storage:
dbPath: /var/lib/mongodb
repairPath: /var/lib/mongodb/.repair
directoryPerDB: true
journal:
enabled: true
engine: "mmapv1"
mmapv1:
smallFiles: true
@sonywork
sonywork / alfred-clipboard.sh
Created March 11, 2020 14:30 — forked from pirate/alfred-clipboard.sh
Script to manage searching, backing up, and collecting infinite clipboard history from the Alfred Clipboard History on macOS.
#!/usr/bin/env bash
# This is a script that provides infinite history to get around Alfred's 3-month limit.
# It works by regularly backing up and appending the items in the alfred db to a
# sqlite database in the user's home folder. It also provides search functionality.
# https://www.alfredforum.com/topic/10969-keep-clipboard-history-forever/?tab=comments#comment-68859
# https://www.reddit.com/r/Alfred/comments/cde29x/script_to_manage_searching_backing_up_and/
# Example Usage:
# alfred-clipboard.sh backup
@sonywork
sonywork / mysql-docker.sh
Created May 30, 2019 07:31 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@sonywork
sonywork / docker_stats_with_names.sh
Created May 26, 2019 16:48 — forked from SQiShER/docker_stats_with_names.sh
Docker stats with Container Names instead of IDs
docker stats $(docker inspect -f '{{.Name}}' $(docker ps -q) | cut -c 2-)
@sonywork
sonywork / Dockerfile
Created May 24, 2019 18:57 — forked from phillipuniverse/Dockerfile
Spring Boot exectuable jar Dockerfile with JAVA_OPTS, debugging and JRebel support
# Used as a base image that other Spring Boot-based
# docker containers can be based off of. Example dependent Dockerfile:
#
# FROM <this-image>
# ADD target/myjar.jar /app.jar
#
# Alternatively, you can modify this file to use a build arg:
# ...
# ...
# ARG JAR_FILE
@sonywork
sonywork / ifcfg-he-ipv6
Created June 3, 2018 20:07 — forked from briancline/ifcfg-he-ipv6
HE.net IPv6 Tunnel Broker - CentOS/RHEL/Fedora NIC config
DEVICE="he-ipv6"
DEVICETYPE=sit
BOOTPROTO=none
ONBOOT=yes
IPV6INIT=yes
IPV6TUNNELIPV4=184.105.253.10
IPV6TUNNELIPV4LOCAL=XXX.XXX.XXX.XXX
IPV6ADDR=2001:470:YYYY:YYYY::2/64
IPV6_DEFAULTGW=2001:470:YYYY:YYYY::1
@sonywork
sonywork / network-unix.c
Created May 26, 2018 01:21 — forked from AlainODea/network-unix.c
WIP: MAC-based implementation of maccopy network-unix.c in network-info Haskell package
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <sys/types.h>
#include <ifaddrs.h>
#include <netdb.h>
#ifdef __linux__
@sonywork
sonywork / pf_getrules.c
Created May 25, 2018 16:11 — forked from sbz/pf_getrules.c
pf: ioctl get rules call debugging
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#ifdef __FreeBSD__
#include <sys/endian.h>
#endif
#include <net/if.h>
#include <net/pfvar.h>
type Api struct {
*revel.Controller
}
func addHeaderCORS(c *revel.Controller) revel.Result {
c.Response.Out.Header().Add("Access-Control-Allow-Origin","*")
return nil
}
func init() {
@sonywork
sonywork / gist:8ca100c86d2e4ddb6bbb7977519e8d3a
Created November 13, 2017 17:22 — forked from putermancer/gist:847755
git + gitolite shell access, user-based
#!/bin/bash
shift # get rid of -c
# if no commands, just open a shell
if [[ $# -eq 0 ]]; then
/bin/bash -l
# if the first arg is a git- command, that means it is something like git-push, etc... so forward it
elif [[ $1 == git-* ]]; then
ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $*