Skip to content

Instantly share code, notes, and snippets.

View regardfs's full-sized avatar
🎯
Focusing

Leo.feng regardfs

🎯
Focusing
View GitHub Profile
@regardfs
regardfs / install-phantomjs-from-taobao.sh
Created October 3, 2016 11:22
install phantomjs from taobao
PHANTOMJS_CDNURL=https://npm.taobao.org/dist/phantomjs npm install phantomjs --registry=https://registry.npm.taobao.org --no-proxy
@regardfs
regardfs / zabbit2pylab.py
Created October 21, 2016 10:08 — forked from chenryn/zabbit2pylab.py
get zabbix history then plot it
#!/usr/bin/env python
"""
Read item history from zabbix, and plot as histogram
"""
import matplotlib
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import requests
import json
@regardfs
regardfs / changesets.groovy
Created January 5, 2017 09:36 — forked from lsjostro/changesets.groovy
Jenkinsfile: build only changed files
#!groovy
@NonCPS
def getACIChangeSets() {
def aci = []
currentBuild.rawBuild.getChangeSets().each { cs ->
cs.getItems().each { item ->
item.getAffectedFiles().each { f ->
if (f.path.endsWith(".yml")) {
aci << f.path
}
@regardfs
regardfs / convert_currency.rb
Created January 18, 2017 03:42 — forked from ylluminate/convert_currency.rb
Use Google calculator to convert currency in Ruby
require 'faraday'
require 'faraday_middleware'
require 'json'
# Debug:
# require "pry"
country_code_src = "USD"
@regardfs
regardfs / vm-resize-hard-disk.md
Created January 22, 2017 07:35 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

#!/usr/bin/env bash
# create self-signed server certificate:
read -p "Enter your domain [www.example.com]: " DOMAIN
echo "Create server key..."
openssl genrsa -out $DOMAIN.key 2048
@regardfs
regardfs / readme.md
Created February 9, 2017 10:39 — forked from ashrithr/readme.md
Installing ELK on a single machine

Installing ELK (CentOS)

This is a short step-by-step guide on installing ElasticSearch LogStash and Kibana Stack on a CentOS environment to gather and analyze logs.

I. Install JDK

rpm -ivh https://dl.dropboxusercontent.com/u/5756075/jdk-7u45-linux-x64.rpm
@regardfs
regardfs / logstash-suse
Created February 11, 2017 05:17 — forked from shadabahmed/logstash-suse
Logstash init.d script and config file. Ubuntu script is borrowed from http://www.vmdoh.com/blog/centralizing-logs-lumberjack-logstash-and-elasticsearch SuSe script is for SLES. Just copy the script to /etc/init.d as logstash
#! /bin/sh
### BEGIN INIT INFO
# Provides: logstash
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
@regardfs
regardfs / gist:23cd7660d2c6fd1cf46fd07f2e7356af
Created February 14, 2017 14:44
python-autocomplete-setting.sh
# if you are in python3.X env, you should run
sudo apt-get install python3-dev
sudo apt-get install libevent-dev
sudo apt-get install libncurses5-dev
# if you are in python2.x env, then sudo apt-get install python-dev
# install readline
pip install readline
# config $HOME/.bashrc
@regardfs
regardfs / python-autocomplete-setting.sh
Last active February 17, 2017 08:53
python-autocomplete-setting.sh
#!/usr/bin/env bash
# if you are in python3.X env, you should run
sudo apt-get -y install python3-dev libevent-dev libncurses5-dev
# if you are in python2.x env, then sudo apt-get install python-dev
# install readline
pip install readline
# config $HOME/.bashrc