Skip to content

Instantly share code, notes, and snippets.

View jage's full-sized avatar

Johan Eckerström jage

View GitHub Profile
@jage
jage / tls_test.rb
Created December 11, 2014 13:16
Test TLSv1.1 against Ori
require 'openssl'
require 'socket'
context = OpenSSL::SSL::SSLContext.new
context.ssl_version = :TLSv1_1
client_socket = TCPSocket.new 'ori', 5671
ssl_client = OpenSSL::SSL::SSLSocket.new client_socket, context
ssl_client.connect
@jage
jage / xml-rpc-ping.lua
Last active August 29, 2015 14:19
To be used with wrk
wrk.method = "POST"
wrk.body = '<?xml version="1.0"?><methodCall><methodName>weblogUpdates.ping</methodName><params><param><value>Twingly Blog</value></param><param><value>http://blog.twingly.com/</value></param></params></methodCall>'
wrk.headers["Content-Type"] = "text/xml"
@jage
jage / check_zookeeper.sh
Last active January 7, 2018 14:11
Consul (Nagios) compatible script to check ZooKeeper node
#!/bin/sh
test "$(echo ruok | nc 127.0.0.1 2181)" = "imok" || $(exit 2)
@jage
jage / find-unused-csproj.sh
Last active August 29, 2015 14:23
Find unused csproj files by searching through sln files
find . -iname '*.csproj' | sort | uniq | while read csprojpath; do
grep -i $(basename $csprojpath) $(find . -iname '*.sln' -print) > /dev/null || echo "$csprojpath does not seem to be used"
done
@jage
jage / README.md
Last active August 29, 2015 14:26

My prompt has some information in the far right, which is superuseful and pretty but not that nice when copying command output to share with my co-workers.

Example from the clipboard:

$ uptime                                                        jage@11D0D585 ~
22:46  up  1:14, 2 users, load averages: 1,74 1,85 1,70
$ date jage@11D0D585 ~
@jage
jage / office-dashboard-terminal.yml
Last active October 15, 2021 09:33
Ansible playbook to schedule display sleep (macOS/OS X)
---
- hosts: office-dashboard-terminal
become: yes
tasks:
- name: Ensure displays are up during office hours
cron:
name="Activate display"
minute="0"
hour="8"
weekday="1-5"
@jage
jage / README.md
Last active April 26, 2016 18:26
Twingly Search API in Clojure (https://github.com/twingly/twingly-search-api-java)
  • lein new app clojure-twingly-search-api
  • edit clojure-twingly-search-api/project.cli and add dependencies:
  :dependencies [
                  [org.clojure/clojure "1.8.0"],
                  [com.twingly/twingly-search-api-java "1.0.0"]
                ]
@jage
jage / dmesg.txt
Created July 11, 2016 14:34
OpenBSD 5.9/amd64 Mac Pro 2009
OpenBSD 5.9 (GENERIC.MP) #1888: Fri Feb 26 01:20:19 MST 2016
deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
RTC BIOS diagnostic error cd<clock_battery,ROM_cksum,fixed_disk,invalid_time>
real mem = 12856193024 (12260MB)
avail mem = 12462358528 (11885MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x7749f000 (149 entries)
bios0: vendor Apple Inc. version "MP41.88Z.0081.B07.0910130729" date 10/13/09
$ ruby test.rb
4
3
2
1
0
@jage
jage / innodb-tables-to-alter.sql
Created October 19, 2016 15:30
InnoDB tables to run `ALTER TABLE ... FORCE` on after a MySQL 5.5 -> 5.6 upgrade
# Improved version of http://mysqlserverteam.com/upgrading-old-mysql-5-5-format-temporals-to-mysql-5-6-format-2/#comment-746
SELECT t.table_schema,t.table_name,c.column_name,c.column_type, iss.num_rows
FROM information_schema.tables t
INNER JOIN information_schema.columns c ON c.table_Schema = t.table_schema AND c.table_name = t.table_name
INNER JOIN information_schema.innodb_sys_tables ist ON ist.name = concat(t.table_schema,"/",t.table_name)
INNER JOIN information_schema.innodb_sys_columns isc ON isc.table_id = ist.table_id AND isc.name = c.column_name
INNER JOIN information_schema.innodb_sys_tablestats iss ON iss.name = concat(t.table_schema,"/",t.table_name)
WHERE t.engine = "innodb"
AND c.column_type IN ("time","timestamp","datetime")
AND isc.mtype = 6