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
#!/usr/bin/env ruby | |
NEW_NS_SERVER="ns-561.awsdns-06.net" | |
OLD_NS_SERVER="ns.udag.net" | |
def clean_up_answer(ns_answer) | |
answer_section = nil | |
ns_answer.match(%r{^;; ANSWER SECTION:\s*(.*?\n)\n}m) do |match| | |
answer_section = match[1] | |
end |
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
module Memoize | |
def memoize(method_name) | |
ivar_name = :"@#{method_name}" | |
aliased_method_name = :"__unmemoized_#{method_name}" | |
alias_method aliased_method_name, method_name | |
define_method method_name do | |
return instance_variable_get(ivar_name) if instance_variable_defined?(ivar_name) | |
instance_variable_set(ivar_name, send(aliased_method_name)) |
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
2019-09-19 13:00:51 - [sway/main.c:152] Linux plinth 5.1.16 #1 SMP PREEMPT Fri Jul 5 21:04:54 CEST 2019 x86_64 GNU/Linux | |
2019-09-19 13:00:51 - [sway/main.c:168] Contents of /etc/lsb-release: | |
2019-09-19 13:00:51 - [sway/main.c:152] LSB_VERSION=1.4 | |
2019-09-19 13:00:51 - [sway/main.c:152] DISTRIB_ID=Arch | |
2019-09-19 13:00:51 - [sway/main.c:152] DISTRIB_RELEASE=rolling | |
2019-09-19 13:00:51 - [sway/main.c:152] DISTRIB_DESCRIPTION="Arch Linux" | |
2019-09-19 13:00:51 - [sway/main.c:168] Contents of /etc/os-release: | |
2019-09-19 13:00:51 - [sway/main.c:152] NAME="Arch Linux" | |
2019-09-19 13:00:51 - [sway/main.c:152] PRETTY_NAME="Arch Linux" | |
2019-09-19 13:00:51 - [sway/main.c:152] ID=arch |
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
#!/usr/bin/bash | |
VAULT_USER=sr | |
SSH_SOCKET=$HOME/.ssh/control/vault | |
REMOTE_HOST=app1.staging.givve.io | |
VAULT_HOST=vault.givve.io | |
export VAULT_ADDR="https://$VAULT_HOST:8200" | |
export VAULT_CACERT="/home/sr/src/givve/givve/config/certs/vault_cacert.pem" |
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
#!/usr/bin/env ruby | |
require_relative '../config/environment' | |
class TableStats | |
include ActionView::Helpers::NumberHelper | |
OUTPUT_HEADER = sprintf "%-32s %10s %10s %10s %10s\n", "Table name", "Tuples", "Size", "#Seq. Scans", "#Index Scans" | |
def initialize( attrs = {} ) | |
@attributes = attrs |
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
-- Standard awesome library | |
local awful = require("awful") | |
awful.autofocus = require("awful.autofocus") | |
awful.rules = require("awful.rules") | |
-- Theme handling library | |
local beautiful = require("beautiful") | |
local gears = require("gears") | |
-- Notification library | |
local naughty = require("naughty") | |
local vicious = require("vicious") |
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
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY! | |
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
# | |
# Deployment structure | |
# | |
# SERVER: | |
# /etc/init.d/nginx (1. nginx) | |
# /home/app/public_html/app_production/current (Capistrano directory) | |
# |
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
alias.lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- |
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
file = File.readlines( "20120628T111327_1" ) | |
hash = {} | |
pairs = file.grep( /extid|opt_out_url/ ). | |
map { |e| e.gsub( /<.*?>/, '' ) }. | |
map(&:strip) | |
pairs.shift | |
pairs.each_slice( 2 ) { |e| hash[e[0].to_i] = e[1] } | |
hash.delete(0) | |
NewerOlder