Skip to content

Instantly share code, notes, and snippets.

@goncha
goncha / gist:4037341
Created November 8, 2012 07:09
BASH script to control tomcat instance on customized CATALINA_BASE with CATALINA_PID
#!/bin/sh
usage () {
echo "Usage: $0 <startup|shutdown>"
exit 1
}
if [ $# -lt 1 ]
then
usage
@goncha
goncha / sendgraph.py
Created November 15, 2012 07:36 — forked from bkjones/sendgraph.py
Fork from bkjones, nagios command to send graphite graph by email
#!/usr/bin/env python
"""
This takes a recipient email address and a graphite URL and sends a
POST to <graphite host>/dashboard/email with a body that looks like
this:
sender=user%40example.com&recipients=user2%40example.com&subject=foo&message=bar&graph_params=%7B%22target%22%3A%22target%3DdrawAsInfinite(metric.path.in.graphite)%22%2C%22from%22%3A%22-2hours%22%2C%22until%22%3A%22now%22%2C%22width%22%3A600%2C%22height%22%3A250%7D
...which will cause the graphite installation to send an email.
@goncha
goncha / haproxy.cfg
Created January 11, 2013 02:02
Haproxy and syslog sample
global
log /dev/log local0 info
#log loghost local0 info
maxconn 1024
#chroot /home/app/var/haproxy
user app
group users
daemon
pidfile /home/app/var/haproxy.pid
stats socket /home/app/var/haproxy.sock
@goncha
goncha / curl-socks5.txt
Last active December 11, 2015 11:08
curl socks5 proxy
root@devops3:~# cat .curlrc
socks5-hostname = localhost
socks5 = localhost
@goncha
goncha / git-proxy.txt
Last active January 20, 2020 17:20
Git and socks5 proxy
gang@debian:~$ sudo apt-get install netcat-openbsd
gang@debian:~$ cat /usr/local/bin/git-proxy-wrapper
#!/bin/bash
nc -xlocalhost:1080 -X5 $*
gang@debian:~$ export GIT_PROXY_COMMAND=/usr/local/bin/git-proxy-wrapper
@goncha
goncha / jquery-flot.html
Last active December 16, 2015 07:59
jQuery Flot query Graphite data
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"></meta>
<title>Graphite Flot Example</title>
<style type="text/css">
#graphite {
width: 300px;
height: 200px;
font-size: 14px;
@goncha
goncha / cjk-latex.tex
Last active December 16, 2015 21:39
Latex in Chinese
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK*}{UTF8}{gbsn}
这是一个测试
\end{CJK*} (this is a test)
\end{document}
@goncha
goncha / about-filter
Created July 12, 2013 04:43
cgit's about-filter, to render text file with line breaks
#!/usr/bin/env perl
print "<pre>\n";
while (<STDIN>) { print; }
print "</pre>\n";
@goncha
goncha / fedora-setup.org
Last active December 20, 2015 14:39
Fedora 20 Setup

System

  1. Disable SELinux in `/etc/selinux/config` (need reboot)
  2. Install RPMFusion free&nofree repos rpm
  3. Install Wifi BCM4313 driver `yum install kmod-wl` after Step 2
  4. Install Adobe and Google repos rpm
  5. Install 163 mirror repos (http://mirrors.163.com/.help/fedora.html)
  6. Install build-essential alternative, `yum install make automake gcc gcc-c++ kernel-devel` or `yum-builddep sqlite` or `yum groupinstall “Development Tools”`
  7. Configure yum use proxy in /etc/yum.conf
@goncha
goncha / haproxy-naming-based-dispatch.conf
Created August 12, 2013 05:31
Haproxy naming based dispatch
backend host1
mode http
server inst1 host1:port1
backend host2
mode http
server inst1 host2:port2
frontend http-in
bind :80