Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.node circle {
fill: #fff;
stroke: steelblue;
stroke-width: 3px;
}
@ashayh
ashayh / index.html
Created October 21, 2012 00:49 — forked from crofty/index.html
A example of using Google Map tiles with the Leaflet mapping library - http://matchingnotes.com/using-google-map-tiles-with-leaflet
<!DOCTYPE html>
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://code.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="https://raw.github.com/gist/2197042/2b90c41b39b7d5b3a851d8f256de2ebd3fe1fb74/leaflet-google.js"></script>
</head>
<body>
@ashayh
ashayh / jenkins-keygen.sh
Created March 5, 2018 23:43 — forked from iocanel/jenkins-keygen.sh
Jenkins key generation
#Generate master.key and secret
MAGIC="::::MAGIC::::"
mkdir -p /var/jenkins_home/secrets
openssl rand -hex 128 > /var/jenkins_home/secrets/master.key
openssl dgst -sha256 -binary /var/jenkins_home/secrets/master.key > /tmp/master.hashed
HEX_MASTER_KEY=`head -c 16 /tmp/master.hashed | xxd -l 16 -p`
openssl rand 259 > /tmp/base
echo $MAGIC >> /tmp/base
openssl enc -aes-128-ecb -in /tmp/base -K $HEX_MASTER_KEY -out /var/jenkins_home/secrets/hudson.util.Secret
@ashayh
ashayh / logging.bash
Created July 7, 2017 22:27 — forked from goodmami/logging.bash
Basic logging commands for Linux shell scripts
#!/bin/bash
##
## Simple logging mechanism for Bash
##
## Author: Michael Wayne Goodman <goodman.m.w@gmail.com>
## Thanks: Jul for the idea to add a datestring. See:
## http://www.goodmami.org/2011/07/simple-logging-in-bash-scripts/#comment-5854
## Thanks: @gffhcks for noting that inf() and debug() should be swapped,
## and that critical() used $2 instead of $1
@ashayh
ashayh / bash functrace
Created July 7, 2017 22:01 — forked from ryo1kato/bash functrace
Backtrace for bash
#!/bin/bash
set -ue
bash_trace () {
typeset -i i=0
for func in "${FUNCNAME[@]}"
do
printf '%15s() %s:%d\n' \
"$func" "${BASH_SOURCE[$i]}" "${BASH_LINENO[$i]}"
@ashayh
ashayh / performance.txt
Created June 12, 2017 20:46 — forked from dstroot/performance.txt
Performance Tuning your TCP Stack
#!/bin/bash
echo "*****************************************"
echo " Based on information from Google"
echo " http://dev.chromium.org/spdy/spdy-best-practices"
echo "*****************************************"
sudo su
yum –y update
echo "*****************************************"
echo " Changing initcwnd and initrwnd"
echo " Step 1: check route settings."
@ashayh
ashayh / oracle_export.rb
Created November 4, 2016 21:08 — forked from rogerleite/oracle_export.rb
Access Oracle with jruby using JDBC. Export data to json format.
=begin
Requisitos Minimos para rodar este script:
#jruby 1.1 ou superior (nao testei com superior :D)
apt-get install jruby
#baixar o oracle jdbc (para o 10g, ou procure a versão que deseje) de:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html
#copiar o ojdbc14.jar para (usar sudo):
@ashayh
ashayh / load-balance.sh
Created October 2, 2016 18:23 — forked from girst/load-balance.sh
Simple Linux Load Balancing with `iproute2`
#!/bin/bash
# Load balance multiple internet connections. Requires iproute2, awk and grep.
# (C) 2016 Tobias Girstmair, isticktoit.net, GPLv2
# Also useful: speedometer -l -r eth1 -t eth1 -m $(( 1024 * 1024 * 3 / 2 ))
# Not much user error checking is done - only pass working network connections
# script needs root to work and at least two connections to be useful
[ $EUID -eq 0 -a $# -ge 2 ] || {
echo "Usage (as root): $0 iface1 iface2 ..." >&2
@ashayh
ashayh / crtime.sh
Created January 19, 2013 01:53
Extract ext4 creation (crtime) of file
#!/bin/bash
# Author: ashay dot humane at gmail.com
# Given a file name, this script prints the file creation time,
# as ext4 records it
# Might error out on other filesystems
DEBUGFS="/sbin/debugfs"
[[ -f "$1" ]] || { echo "Invalid filename. Exiting" ; exit 1; }