This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python3 -c 'import sys, yaml, json; j=json.loads(sys.stdin.read()); print(yaml.safe_dump(j))' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if (( $# < 1 )) | |
then | |
echo "Usage: $0 username" | |
exit 1 | |
fi | |
username="$1" | |
json_left='{"input01":{"Input":"GmailAddress","GmailAddress":"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on http://uberblo.gs/2011/06/high-performance-url-shortening-with-redis-backed-nginx | |
# using code from http://stackoverflow.com/questions/3554315/lua-base-converter | |
# "database scheme" | |
# database 0: id ~> url | |
# database 1: id ~> hits | |
# database 2: id ~> [{referer|user_agent}] | |
# database 3: id ~> hits (when id is not found) | |
# database 4: id ~> [{referer|user_agent}] (when id is not found) | |
# database 5: key "count" storing the number of shortened urls; the id is generated by (this number + 1) converted to base 62 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#/ jc -- jconsole via ssh proxy | |
#/ | |
#/ Usage: jc [options] HOST JMX_PORT [PROXY_PORT=JMX_PORT] [JMX_HOST=HOST] | |
#/ | |
#/ Starts a SOCKS proxy via ssh to connect to a | |
#/ JVM running on a remote and protected machine. | |
#/ | |
#/ Arguments: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SSH agent forwarding is great. It allows you to ssh from one server to | |
another all the while using the ssh-agent running on your local | |
workstation. The benefit is you don't need to generate ssh key pairs | |
on the servers you are connecting to in order to hop around. | |
When you ssh to a remote machine the remote machine talks to your | |
local ssh-agent through the socket referenced by the SSH_AUTH_SOCK | |
environment variable. | |
So you the remote server you can do something like: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Check if variable is defined | |
# Replaces has_variable?(var) and if @var variations. | |
# include?() pattern from @Jan_vStone. | |
# | |
# scope.lookupvar return values for undefined variables: | |
# Puppet 3.x: nil | |
# Puppet 2.6.x: :undefined | |
# Puppet 2.7.x: :undefined | |
<% if ! [:undefined, nil, ''].include?(masquerade_address = scope.lookupvar('ftp::masquerade_address')) -%> | |
MasqueradeAddress <%= masquerade_address %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Generate a unique integer id base on the hostname | |
# It works by stripping $domain from the $::fqdn, | |
# removing all characters except alphanumeric and converting to base 10 | |
# $domain is provided if you have complex domains like *.hosting.example.com | |
# | |
class uniqueid ( | |
$domain = $::domain, | |
) { | |
$node_id = inline_template("<%= '$::fqdn'.gsub('$domain','').gsub(/[^a-z0-9]/i,'').to_i(36) %>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default backend definition. Set this to point to your content server. | |
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
.connect_timeout = 60s; | |
.first_byte_timeout = 60s; | |
.between_bytes_timeout = 60s; | |
.max_connections = 800; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node demo { | |
nagios::host::service { 'ping': | |
check_command => 'check_ping', | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
int main() | |
{ | |
printf ("kill -9 <parent>\n"); | |
kill (getppid(), 9); | |
} |
OlderNewer