Skip to content

Instantly share code, notes, and snippets.

@vmadman
vmadman / gTile-Presets.txt
Last active October 13, 2022 16:12
gTile Resize Presets
Grid Sizes: 15x1,4x2,15x2
My Favorite Presets for gTile.
Featured/Focus
01: 15x1 1:1 4:1
02: 15x1 5:1 11:1
03: 15x1 12:1 15:1
4-Columns
04: 4x1 1:1 1:1,2:1 2:1,1:1 2:1
@vmadman
vmadman / apache-json-log-format
Created April 27, 2013 06:59
An apache log format that allow access logs (but not error logs) to be output in JSON format. I found this here: http://untergeek.com/2012/10/11/getting-apache-to-output-json-for-logstash/ -- but modified it for my purposes a good bit.
# Access Logs
LogFormat "{ \
\"@vips\":[\"%v\"], \
\"@source\":\"%v%U%q\", \
\"@source_host\": \"%v\", \
\"@source_path\": \"%f\", \
\"@tags\":[\"Apache\",\"Access\"], \
\"@message\": \"%h %l %u %t \\\"%r\\\" %>s %b\", \
\"@fields\": { \
\"timestamp\": \"%{%Y-%m-%dT%H:%M:%S%z}t\", \
@vmadman
vmadman / packer-config.json
Last active August 1, 2017 17:12
Packer log: Error deleting VM
{
"variables" : {
"source_name" : "centos-7.3-x86_64-raw-r1",
"headless" : "false",
"http_proxy" : "{{env `http_proxy`}}",
"https_proxy" : "{{env `https_proxy`}}",
"memory" : "2048",
"metadata" : "packer/floppy/dummy_metadata.json",
"name" : "centos-7.3",
"no_proxy" : "{{env `no_proxy`}}",
@vmadman
vmadman / create-concrete.lua
Created March 26, 2017 15:26
Factorio: Create Concrete Area (10,000 tiles)
/c for i=-100,100 do for j=-100,100 do game.player.surface.set_tiles({{name="concrete", position={game.player.position.x+i, game.player.position.y+j}}}) end end
@vmadman
vmadman / logstash-supervisord
Created April 27, 2013 06:48
An example SupervisorD configuration for all three logstash components. Some of it might look obvious, but it took a ton of tweaking to figure it out. (but I might just be dumb)
[program:lss]
process_name=Shipper
command=java -jar /usr/local/logstash/bin/logstash-1.1.9-monolithic.jar agent --config /usr/local/logstash/conf/shipper.conf --log /usr/local/logstash/log/shipper.log
user=logstash
startretries=3
redirect_stderr=true
std_out_logfile=NONE
startsecs=3
environment=HOME="/usr/local/logstash/"
@vmadman
vmadman / tmpSugarFix.ts
Created December 19, 2013 04:13
This is *my* current temporary fix to get SugarJS's static method additions working in typescript.
/// <reference path="../path/to/sugar.d.ts" />
/**
* Usage Examples:
* sgObject.isArray([1]); // -> true
*/
declare var sgObject:ObjectStatic;
declare var sgNumber:NumberStatic;
declare var sgDate:DateStatic;
@vmadman
vmadman / logio.rb
Last active December 28, 2015 12:49
Log.io output plugin for Logstash -- logstash / lib / logstash / outputs / logio.rb
require "logstash/outputs/base"
require "logstash/namespace"
require "socket"
# Log.io Output
#
# Sends events to a Log.io server over TCP.
#
# Plugin is fault tolerant. If the plugin is unable to connect to the server,
# or writes to a broken socket, it will attempt to reconnect indefinitely.
@vmadman
vmadman / logstash-rsyslog-conf
Created April 27, 2013 07:09
This is the UDP output settings I added to /etc/rsyslog.conf so that it would output system events to my LogStash shipper agent. (shipper is the name I took from the LogStash docs, but basically its the "client", not the "server", as loosely as those words apply to logstash)
# Send syslog to LogStash
*.* @@127.0.0.1:5000
@vmadman
vmadman / apache-virtualhost-log-cfg
Created April 27, 2013 07:03
This is just the log settings I put on each of our virtual hosts so that they pipe logs to LogStash via a UDP proxy. In my setup the error UDP port increments for each virtual host, which allows my LogStash shipper to apply hostnames.
# Error logging to LogStash via UDP client pipe
ErrorLog "||/usr/local/bin/udpclient.pl 127.0.0.1 5002"
LogLevel warn
# Access logging to LogStash via UDP client pipe
CustomLog "||/usr/local/bin/udpclient.pl 127.0.0.1 5001" ls_apache_json
@vmadman
vmadman / apache-perl-udp-pipe
Created April 27, 2013 06:57
A PERL UDP client. This client serves (in my usage) as a pipe target for apache logs. After reception, logs are forwarded to logstash. I found this at: http://untergeek.com/2012/10/11/getting-apache-to-output-json-for-logstash/
#!/usr/bin/perl
#udpclient.pl
use IO::Socket::INET;
my $host = $ARGV[0];
my $port = $ARGV[1];
# flush after every write
$| = 1;
my ($socket,$logdata);