Skip to content

Instantly share code, notes, and snippets.

View aphor's full-sized avatar

Jeremy McMillan aphor

View GitHub Profile
@aphor
aphor / java_signal_exit.md
Created August 12, 2018 19:57
Java default signal handler exit behavior

Thank you to @thobe, please try Neo4J, the coolest NoSQL DB

Tuesday, February 19, 2013 JVMs and kill signals Ever wondered how a JVM reacts to various kill signals? The (intended) behaviour might be documented somewhere already, but I found having a table of > the actual behaviour available quite useful. In particular I wanted to know which kill signals trigger the JVM to run registered shutdown hooks, and > > which kill signals don't actually terminate the JVM. So I decided to compile a table of that information.

I wrote up a small Java application that just registers a shutdown hook that I can detect whether it has executed or not, and then sleeps until I get a chance to kill it:

@aphor
aphor / puffyCloud.md
Last active June 4, 2018 16:52
Puffy Cloud: Ween didn't know how important this song would be to the software industry.
Drift away on a puffy cloud  
Go away on a puffy cloud  
My product is dead from too much vapor  
Cuz (gene) (dean) + I sell too much vapor

Cloudy cloudy cloudy cloud
Cloudy cloud cloudy cloud

Cloudy cloudy cloudy cloud

@aphor
aphor / debug.out
Last active May 29, 2019 21:08
salt orchestration rolling example
$ sudo salt-run --log-level=debug state.orchestrate orch.roll
[DEBUG ] Reading configuration from /opt/local/etc/salt/master
[DEBUG ] Including configuration from '/opt/local/etc/salt/master.d/roots.conf'
[DEBUG ] Reading configuration from /opt/local/etc/salt/master.d/roots.conf
[DEBUG ] Including configuration from '/opt/local/etc/salt/master.d/security.conf'
[DEBUG ] Reading configuration from /opt/local/etc/salt/master.d/security.conf
[DEBUG ] Using cached minion ID from /opt/local/etc/salt/minion_id: salt-master.local
[DEBUG ] Missing configuration file: /Users/aphor/.saltrc
[DEBUG ] Configuration file path: /opt/local/etc/salt/master
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
@aphor
aphor / 403.html
Last active December 29, 2017 20:42
a bare knuckles web server in ~40 lines of Python
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Forbidden</TITLE>
</HEAD><BODY>
<H1>Forbidden</H1>
You do not have permission to access the file.<P>
<HR>
<ADDRESS>ws.py Server at nuada.local Port 6780</ADDRESS>
</BODY></HTML>
@aphor
aphor / main.log
Last active February 24, 2017 14:45
This file has been truncated, but you can view the full file.
:debug:main epoch: in tree: 0 installed: 0
:debug:main py27-setuptools 34.2.0_0 exists in the ports tree
:debug:main py27-setuptools 34.2.0_0 is the latest installed
:debug:main py27-setuptools 34.2.0_0 is active
:debug:main Merging existing variants '' into variants
:debug:main new fully merged portvariants:
:debug:main Changing to port directory: /opt/local/var/macports/sources/rsync.macports.org/release/ports/python/py-setuptools
:debug:main OS darwin/16.3.0 (Mac OS X 10.12) arch i386
:debug:main Re-registering default for build.cmd
:debug:main Re-registering default for destroot.cmd
@aphor
aphor / new_cloud_minion.sls
Last active July 27, 2016 14:58
SaltStack salt-cloud event reactor driven orchestration for automatic complex minion initialization
## /salt/reactor/common/new_cloud_minion.sls
post_bootstrap_setup:
runner.state.orchestrate:
- mods: orch.selinux_relabel_reboot_highstate
- pillar:
event_tag: {{ tag }}
event_data: {{ data }}
/dev/ebsvol0:
file.exists:
- onfail:
- cmd: create_attach_ebs_data_vol
create_attach_ebs_data_vol:
cmd.call:
- name: cloud.action
- func: create_attach_volumes
- instance: {{ monsoon.master }}
@aphor
aphor / trending_histogram_heap_dumps.sh
Last active March 25, 2016 13:32
If you don't have a tool like DynaTrace, maybe you can collect some trending heap histograms for analysis in pandas?
@aphor
aphor / port_info_salt.out
Created March 22, 2016 00:04
What's up with MacPorts via SaltStack?
$ port info salt
salt @2015.8.5 (sysutils)
Description: SaltStack is fast, scalable and flexible software for data center automation, from infrastructure and any
cloud, to the entire application stack.
Homepage: http://saltstack.com/
Build Dependencies: py27-setuptools
Library Dependencies: python27, py27-crypto, py27-jinja2, py27-msgpack, py27-pip, py27-yaml, py27-tornado, swig-python
Platforms: darwin
@aphor
aphor / gist:87caccd07a92f11c5d56
Created October 20, 2015 22:23
jeffpatton1971#salt sshd_config_state.sls
/etc/ssh/sshd_config:
file.managed:
- source: salt://sshd/files/sshd_config.jinja
- template: jinja