Skip to content

Instantly share code, notes, and snippets.

View np422's full-sized avatar

Niklas Paulsson np422

View GitHub Profile
xtest=# set lc_numeric='en_US.UTF-8';
SET
xtest=# select to_char(2.34,'999D99');
to_char
---------
2.34
(1 row)
xtest=# set lc_numeric='sv_SE.UTF-8';
SET
# encoding: UTF-8
IRB.conf[:USE_READLINE] = true
IRB.conf[:SAVE_HISTORY] = 200
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history"
<?php
echo ( TRUE ? "a" : TRUE ? "b" : "c" ) . "\n";
?>
@np422
np422 / gist:4493859
Last active December 10, 2015 21:18
Server Software: Microsoft-IIS/7.5
Server Hostname: 10.0.0.15
Server Port: 80
Document Path: /TIPS_Bilder/Artikelbilder/farg_656243_S.png
Document Length: 5595 bytes
Concurrency Level: 200
Time taken for tests: 0.066 seconds
Complete requests: 1000

Ideal Postgres environment

Documentation

  • Documented replication topology
  • Documented network topology
  • Documented interface topology - including users, passwords, connection estimates, load balancers, connection proxies
  • Documented procedure, schedule for failover and testing
  • Documented procedure, schedule for disaster recovery and testing
#!/bin/bash
# sudo apt-get install xvfb feh
# edit the screen resolution below to suite your display
trap "pkill xvfb ; pkill gnome-terminal ; exit" SIGINT SIGTERM SIGHUP
( xvfb-run -a -s "-screen 0 1920x1080x24 -fbdir /var/tmp" /usr/bin/gnome-terminal --window --full-screen --hide-menubar --geometry=1920x1080+0+0 --disable-fa\
ctory -e htop ) 2>&1 >/dev/null &
while $(true)
@np422
np422 / format_helper.rb
Last active February 29, 2016 03:32
Ruby script to print any process environment variables on stdout
#
# Formatting functions and constants
#
class FormatHelper
require 'English'
attr_reader :terminal_lines, :terminal_columns
# Returns a FormatHelper that know about your current terminal
# and how to format the key,value pairs in the hash envpairs
# for output
@np422
np422 / parse_vcloud_xml.rb
Created August 24, 2016 13:47
Small script to parse xml-output from vcloud api
#!/usr/bin/env ruby
require "json"
require "crack"
myXML = Crack::XML.parse(File.read( ARGV[0] ))
myJSON = myXML.to_json
vAPP = JSON.parse(myJSON)
log = Syslog::Logger.new 'app-epr-dashboard'
date_sent_perfdata = Date.today - 1.day
n_logmsg_sent = 0
N_LOGMESSAGES_PER_DAY = 20
SCHEDULER.every '300s' do
url1 = "https://issue.admin.conextrade.com/"
board_id = 3
c = JSONClient.new