start new:
tmux
start new with session name:
tmux new -s myname
#!/bin/bash | |
current_version=$(terraform -v | head -n1 | cut -dv -f2) | |
echo "Running terraform $current_version" | |
echo -n "Checking for updates..." | |
version=$(curl -s https://releases.hashicorp.com/terraform/ | grep -vE '(alpha|beta|rc)' | grep 'href="/terraform' | cut -d\" -f2 | head -n1 | cut -d\/ -f3) | |
if [ "$version" = "$current_version" ]; then |
DOMAIN_WHITELIST { | |
map = "redis://whitelist_domains"; | |
type = "from"; | |
action = "accept"; | |
filter = "email:domain"; | |
} | |
USER_WHITELIST { | |
map = "redis://whitelist_senders"; | |
type = "from"; |
# coding: utf-8 | |
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer | |
class S(BaseHTTPRequestHandler): | |
def do_GET(self): | |
data = [ { "Nome": "asdf" }, { "Nome": "fdsa" } ] | |
self.send_response(200) | |
self.send_header("Content-type", "text/html") | |
self.end_headers() |
import jenkins.model.* | |
def matchedJobs = Jenkins.instance.items.findAll { job -> | |
job.name =~ /my_regex_here/ | |
} | |
matchedJobs.each { job -> | |
println job.name | |
//job.delete() | |
} |
<?php | |
/** | |
* Based on https://engineering.classdojo.com/blog/2015/02/06/rolling-rate-limiter/ | |
*/ | |
for ($i = 1; $i < 20; $i++) { | |
// limit 5 runs of action by ip every 10 seconds, runs function if overflown | |
limit('action', 'ip', 5, 10, function($count) { | |
echo "Ran limit function after $count runs"; |
<?php | |
if (!class_exists('db')) { | |
class db implements Illuminate\Database\ConnectionResolverInterface { | |
/** | |
* Get a database connection instance. | |
* | |
* @param string $name | |
* @return \Illuminate\Database\ConnectionInterface | |
*/ | |
public function connection($name = null) |
#!/bin/bash | |
# ----------------------------------------------------------- | |
# -- Write psdthumbnailer | |
# ----------------------------------------------------------- | |
OUTFILE=/usr/lib/psdthumbnailer | |
( | |
sudo cat <<'EOF' | |
# bin/bash |
I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.
What I decided on was the following: put your secret information into a vars
file, reference that vars
file from your task
, and encrypt the whole vars
file using ansible-vault encrypt
.
Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.