Skip to content

Instantly share code, notes, and snippets.

View robinsmidsrod's full-sized avatar

Robin Smidsrød robinsmidsrod

View GitHub Profile
@robinsmidsrod
robinsmidsrod / iPXE.xml
Last active June 26, 2024 09:25
iPXE script syntax highlighting for Notepad++
<NotepadPlus>
<UserLang name="iPXE" ext="ipxe" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="1" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="yes" Keywords4="yes" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00# 01 02((EOL)) 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2">0x</Keywords>
@robinsmidsrod
robinsmidsrod / _json-logger.md
Created December 18, 2012 10:10
json-logger: A practical script to capture multiline output from e.g. cron jobs into a single logstash JSON event

Can be used in crontab like this:

SHELL=/bin/bash
BASH_ENV=~/.bash_profile
# m h  dom mon dow   command
0    * * * * /home/portfolio/portfolio/bin/session.pl                2> >(json-logger -ep pf_session)                | json-logger -p pf_session
0    2 * * * /home/portfolio/portfolio/bin/purge_deleted_messages.pl 2> >(json-logger -ep pf_purge_deleted_messages) | json-logger -p pf_purge_deleted_messages
0,30 * * * * /home/portfolio/portfolio/bin/expire_page_views.pl      2> >(json-logger -ep pf_expire_page_views)      | json-logger -p pf_expire_page_views

I would suggest you put it in /usr/bin to avoid having to setup your PATH variable.

anonymous
anonymous / crontab
Created December 18, 2012 08:44
Logging multiline output from cron jobs using json-logger
SHELL=/bin/bash
BASH_ENV=~/.bash_profile
# m h dom mon dow command
0 * * * * /home/portfolio/portfolio/bin/session.pl 2> >(json-logger -ep pf_session) | json-logger -p pf_session
0 2 * * * /home/portfolio/portfolio/bin/purge_deleted_messages.pl 2> >(json-logger -ep pf_purge_deleted_messages) | json-logger -p pf_purge_deleted_messages
0,30 * * * * /home/portfolio/portfolio/bin/expire_page_views.pl 2> >(json-logger -ep pf_expire_page_views) | json-logger -p pf_expire_page_views
@robinsmidsrod
robinsmidsrod / logstash.conf
Created December 5, 2012 13:01
Logging Windows event log information to Logstash using nxlog and JSON transport
input {
tcp {
type => "syslog"
host => "127.0.0.1"
port => 3514
}
tcp {
type => "eventlog"
host => "10.1.1.2"
port => 3515
@electrical
electrical / RESULTS.md
Created December 2, 2012 12:58 — forked from jordansissel/RESULTS.md
screenshot + code showing how to query logstash/elasticsearch with a graphite function.

logstash queries graphed with graphite.

Operation: Decouple whisper from graphite.

Method: Create a graphite function that does a date histogram facet query against elasticsearch for a given query string for the time period viewed in the current graph.

Reason: graphite has some awesome math functions. Wouldn't it be cool if we could use those on logstash results?

The screenshot below is using logstash to watch the twitter stream of keywords "iphone" "apple" and "samsung" - then I graph them each, so we get an idea of popularity. As a bonus, I also do a movingAverage() on the iphone curve to show you why this is awesome.

@robinsmidsrod
robinsmidsrod / dhcpd.conf
Last active April 9, 2025 20:20
Trying to chainload iPXE with full feature set from a lesser featured one, whilst still being able to boot non-supported cards with UNDI
ddns-update-style none;
deny bootp; #default
authoritative;
include "/etc/dhcp/ipxe-option-space.conf";
# GREEN (private network)
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.100 10.1.1.199;
option subnet-mask 255.255.255.0;
@robinsmidsrod
robinsmidsrod / gist:4001104
Created November 2, 2012 12:37
VirtualBox LAN boot ROM max size calculation
include/iprt/cdefs.h
1888:#define _64K 0x00010000
src/VBox/Devices/PC/DevPcBios.h
43:#define VBOX_LANBOOT_SEG 0xe200
src/VBox/Devices/PC/DevPcBios.cpp
1348: if (cbFileLanBoot > _64K - (VBOX_LANBOOT_SEG << 4 & 0xffff))
$ perl -e 'printf "%x\n", 0x10000 - 0xe200 << 4 & 0xffff'
anonymous
anonymous / gist:3962555
Created October 27, 2012 01:14
#!ipxe
kernel tftp://172.16.100.4/sw/ul/waf/hello
boot hello
@vhotspur
vhotspur / helenos.ipxe
Created October 21, 2012 21:49
iPXE config fo HelenOS
#!ipxe
# Get the ISO from
# http://www.helenos.org/download
# and unpack the files in /boot/ to the directory
# where this file is placed
# (note that you have to enable more than 8 modules
# for multiboot)
kernel kernel.bin
@devicenull
devicenull / gist:3896763
Created October 16, 2012 01:25
Clonezilla Live iPXE config
:imaging
set image_name your-image-name
kernel http://${next-server}/tools/clonezilla-live/vmlinuz initrd=tools/clonezilla-live/initrd.img boot=live live-config noswap nolocales edd=on nomodeset ocs_daemonon="ssh" ocs_live_run="ocs-live-restore" ocs_live_extra_param="--batch -g auto -e1 auto -e2 -r -j2 -p reboot restoredisk ${image_name} sda" ocs_live_keymap="/usr/share/keymaps/i386/qwerty/us.kmap.gz" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 nosplash fetch=http://${next-server}/tools/clonezilla-live/filesystem.squashfs ip=eth0:${netX/ip}:${netX/netmask}:${netX/gateway}:8.8.8.8 ocs_prerun="mount -t nfs ${next-server}:/home/partimag /home/partimag"
initrd http://${next-server}/tools/clonezilla-live/initrd.img
boot