This file contains hidden or 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/sh | |
sed -i '' -e '$a\' $1 |
This file contains hidden or 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 -eu | |
# Dump all mysql databases in to separate files | |
# config | |
user=backup-db | |
dir=/home/backup-db/data/mysql | |
# runtime variables | |
ts=$(date +%Y%m%d%H%M%S) | |
dbs=$(sudo -i -u ${user} mysql -N -r -s -e 'SHOW DATABASES' | egrep -v '^information_schema|performance_schema$') |
This file contains hidden or 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 -eux | |
# http://docs.saltstack.com/en/latest/topics/tutorials/quickstart.html | |
# bootstrap salt minion | |
curl -L https://bootstrap.saltstack.com | sh | |
# make it masterless | |
sed -i 's/^#file_client: remote$/file_client: local/' /etc/salt/minion |
This file contains hidden or 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
namespace :deploy do | |
namespace :git do | |
before :check, :local_repo do | |
on release_roles :all do | |
unless test "[ -d #{fetch(:local_repo_path)} ]" | |
execute :mkdir, '-p', fetch(:local_repo_path) | |
execute :git, "init --bare #{fetch(:local_repo_path)}" | |
end | |
end | |
end |
This file contains hidden or 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
puts Identity.unscoped.group(:provider).count | |
users = User.includes(:identities).all | |
duplicated_providers = %w(ldap ldapmain).sort | |
old_provider = 'ldap' | |
new_provider = 'ldapmain' | |
users.each do |u| | |
next if u.identities.blank? |
This file contains hidden or 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
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
public class Ipify { | |
public static void main(String[] args) throws Exception { | |
URL url = new URL("http://api.ipify.org"); | |
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8")); | |
for (String line; (line = reader.readLine()) != null;) { | |
System.out.println(line); |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'open-uri' | |
entries = [] | |
current_entry = nil | |
doc = Nokogiri::HTML(open('http://www.ohler.com/dev/oj_misc/release_notes.html')) | |
body = doc.at_css('.content_box') | |
body.children.each do |cur| |
This file contains hidden or 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
servername= | |
port= | |
echo \ | |
| openssl s_client -showcerts -servername $servername -connect $servername:$port 2>&1 \ | |
| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \ | |
> $servername.crt |
This file contains hidden or 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 -eux | |
# tested with phoenix 1.3.0 | |
shopt -s nullglob | |
app_path=$1 | |
elixir_version=${ELIXIR_VERSION:-1.6.1} | |
echo n | mix phx.new "$app_path" --no-brunch --no-html | |
cd "$app_path" |
This file contains hidden or 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
service_klass_to_property_keys = { | |
JiraService => %w[api_url url username password] | |
} | |
service_klass_to_property_keys.each do |klass, property_keys| | |
template_properties = klass.find_by!(template: true).properties.slice(*property_keys) | |
klass.find_each do |service| | |
service.properties = service.properties.merge(template_properties) | |
service.save! if service.changed? |