Skip to content

Instantly share code, notes, and snippets.

@jwoschitz
jwoschitz / .screenrc
Created January 19, 2019 11:08 — forked from monokrome/.screenrc
A good .screenrc file, thanks to @kroogs
# Get rid of the startup message
startup_message off
# Stop flashing when I get an alert
vbell off
# Automatically detach if a disconnect occurs
autodetach on
# Think of it as xterm and give me scrolling
@jwoschitz
jwoschitz / keras_distributed.py
Created September 14, 2018 13:50 — forked from vpj/keras_distributed.py
Distributed learning for keras models with tensorflow
'''
The code is inspired from François Chollet's answer to the following quora question[1] and distributed tensorflow tutorial[2].
It runs the Keras MNIST mlp example across multiple servers.
This sample code runs multiple processes on a single host. It can be configured
to run on multiple hosts simply by chaning the host names given in *ClusterSpec*.
Training the model:
@jwoschitz
jwoschitz / kerberos_setup.md
Created October 31, 2017 09:34 — forked from ashrithr/kerberos_setup.md
Set up kerberos on Redhat/CentOS 7

Installing Kerberos on Redhat 7

This installation is going to require 2 servers one acts as kerberos KDC server and the other machine is going to be client. Lets assume the FQDN's are (here cw.com is the domain name, make a note of the domain name here):

  • Kerberos KDC Server: kdc.cw.com
  • Kerberos Client: kclient.cw.com

Important: Make sure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in

@jwoschitz
jwoschitz / http-get-with-requests.py
Created August 14, 2017 08:21
HTTP GET with Python requests
#!/usr/bin/env python
import sys, argparse, logging, requests, json
def main(args, loglevel):
logging.basicConfig(format="%(levelname)s: %(message)s", level=loglevel)
repositories =[]
@jwoschitz
jwoschitz / commandline.py
Created July 27, 2017 08:40 — forked from opie4624/commandline.py
Base Python Command Line template
#!/usr/bin/env python
#
# import modules used here -- sys is a very standard one
import sys, argparse, logging
# Gather our code in a main() function
def main(args, loglevel):
logging.basicConfig(format="%(levelname)s: %(message)s", level=loglevel)
@jwoschitz
jwoschitz / NConverter.java
Created June 12, 2017 23:50
N-Number & ICAO address converter
public class NConverter {
private final String base9; // The first digit (after the "N")
// is always one of these.
private final String base10; // The possible second and third digits
// are one of these.
// Note that "I" and "O" are never used as letters,
// to prevent confusion with "1" and "0"
@jwoschitz
jwoschitz / ssh-multi.sh
Created May 18, 2017 12:28 — forked from dmytro/ssh-multi.sh
Start multiple synchronized SSH connections with Tmux
#!/bin/bash
# ssh-multi
# D.Kovalov
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# a script to ssh multiple servers over multiple tmux panes
starttmux() {
if [ -z "$HOSTS" ]; then
@jwoschitz
jwoschitz / create_objectid.js
Created April 6, 2017 09:45
Create artificial mongodb ObjectId for a given timestamp
print(ObjectId(Math.floor(ISODate("2015-05-07T11:00:00.000Z")/1000).toString(16) + "0000000000000000"))
@jwoschitz
jwoschitz / child_file.php
Created May 5, 2014 22:09
Workaround for get_parent_class in hhvm if spl_autoloader is used
<?php
spl_autoload_register(function ($class) {
// in hhvm, this will not get executed
include 'parent_file.php';
});
// this will return false in hhvm due to https://github.com/facebook/hhvm/issues/2097
var_dump(get_parent_class('C'));
@jwoschitz
jwoschitz / xmas.py
Created November 28, 2013 19:42
rasperry pi message emitter for xmas
import requests
url = 'http://192.168.178.134:8080'
chars = {
" ": [
'0',
'0',
'0',
'0'