Skip to content

Instantly share code, notes, and snippets.

@timoyuen
timoyuen / gist:c1b39b1eb782a724a66ede8cd3534ade
Created April 27, 2016 13:10 — forked from dsummersl/gist:3744192
Example log4j logstash configuration
# one way w/o web interface:
# java -jar lib/playbooks/servers/files/logstash-1.1.1-monolithic.jar agent -f lib/playbooks/servers/files/logstash.conf
# another with a web interface(http://localhost:9292) :
# java -jar lib/playbooks/servers/files/logstash-1.1.1-monolithic.jar agent -f lib/playbooks/servers/files/logstash.conf -- web --backend 'elasticsearch:///?local'
# nc localhost 3333 < logfile
#
# When you are all done, you can delete the 'data' folder to delete the database.
input {
tcp {
@timoyuen
timoyuen / A_Logstash.conf
Created April 29, 2016 02:02 — forked from smougenot/A_Logstash.conf
Logstash Multiline Filter for Java Stacktrace (tested on field)
# stacktrace java as one message
multiline {
#type => "all" # no type means for all inputs
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)"
what => "previous"
}
@timoyuen
timoyuen / Redis SCAN by "regex"
Created May 4, 2016 08:00 — forked from itamarhaber/Redis SCAN by "regex"
Regex-like key name pattern matching in Redis
foo@bar:~$ redis-cli
127.0.0.1:6379> dbsize
(integer) 0
127.0.0.1:6379> set user:1 1
OK
127.0.0.1:6379> set use:the:force luke
OK
127.0.0.1:6379> set non:user a
OK
foo@bar:~$ redis-cli --eval scanregex.lua , "^user"
@timoyuen
timoyuen / README.md
Created June 27, 2016 13:06 — forked from joyrexus/README.md
time in go

Working with time in Go is pretty straightforward.

Times

Get the current local time:

now := time.Now()                                   // 02 Apr 15 14:03

Construct a time with Date(y, m, d, h, m, s, ns, loc):

That’s one of the real strengths of Docker: the ability to go back to a previous commit. The secret is simply to docker tag the image you want.
Here’s an example. In this example, I first installed ping, then committed, then installed curl, and committed that. Then I rolled back the image to contain only ping:
$ docker history imagename
IMAGE CREATED CREATED BY SIZE
f770fc671f11 12 seconds ago apt-get install -y curl 21.3 MB
28445c70c2b3 39 seconds ago apt-get install ping 11.57 MB
8dbd9e392a96 7 months ago 131.5 MB
@timoyuen
timoyuen / config.yml
Created May 2, 2017 08:17 — forked from richtr/config.yml
Parse YAML from bash with sed and awk.
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
password:
apt:
- somepackage
- anotherpackage
@timoyuen
timoyuen / config.yml
Created May 2, 2017 08:17 — forked from richtr/config.yml
Parse YAML from bash with sed and awk.
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
password:
apt:
- somepackage
- anotherpackage
@timoyuen
timoyuen / pulling-and-pushing-to-git.md
Created May 3, 2017 03:47 — forked from jtallant/pulling-and-pushing-to-git.md
Basic Unix + Pulling and Pushing to Git

UNIX Commands

pwd present working directory

ls list current directory contents

ls -la list current directory contents in long format and show hidden files

man <some unix command> Bring up the manual pages for a command. Type q to exit

@timoyuen
timoyuen / README.md
Created May 3, 2017 04:06 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@timoyuen
timoyuen / skydns.yml
Created May 17, 2017 23:37 — forked from DenisIzmaylov/skydns.yml
SkyDNS in Kubernetes example
apiVersion: v1
kind: Service
metadata:
name: kube-dns
namespace: kube-system
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "KubeDNS"
spec: