Skip to content

Instantly share code, notes, and snippets.

Avatar

Luke Chavers vmadman

View GitHub Profile
@vmadman
vmadman / packer-config.json
Last active Aug 1, 2017
Packer log: Error deleting VM
View packer-config.json
{
"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 Mar 26, 2017
Factorio: Create Concrete Area (10,000 tiles)
View create-concrete.lua
/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 / issue_comments_suggestion.bmml
Created Feb 22, 2015
Balsamiq Mockup for Nodebug.me Issue Detail Proposal
View issue_comments_suggestion.bmml
<mockup version="1.0" skin="sketch" fontFace="Balsamiq Sans" measuredW="1322" measuredH="912" mockupW="861" mockupH="861">
<controls>
<control controlID="0" controlTypeID="com.balsamiq.mockups::Label" x="531" y="73" w="-1" h="-1" measuredW="520" measuredH="48" zOrder="3" locked="false" isInGroup="-1">
<controlProperties>
<bold>true</bold>
<color>15658734</color>
<size>40</size>
<text>Triaging%20%26joyent/node%20%231234%26</text>
</controlProperties>
</control>
@vmadman
vmadman / tmpSugarFix.ts
Created Dec 19, 2013
This is *my* current temporary fix to get SugarJS's static method additions working in typescript.
View tmpSugarFix.ts
/// <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 Dec 28, 2015
Log.io output plugin for Logstash -- logstash / lib / logstash / outputs / logio.rb
View 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 Apr 27, 2013
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)
View logstash-rsyslog-conf
# Send syslog to LogStash
*.* @@127.0.0.1:5000
@vmadman
vmadman / apache-virtualhost-log-cfg
Created Apr 27, 2013
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.
View apache-virtualhost-log-cfg
# 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-json-log-format
Created Apr 27, 2013
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.
View apache-json-log-format
# 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 / apache-perl-udp-pipe
Created Apr 27, 2013
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/
View apache-perl-udp-pipe
#!/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);
@vmadman
vmadman / logstash-supervisord
Created Apr 27, 2013
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)
View logstash-supervisord
[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/"
You can’t perform that action at this time.