Skip to content

Instantly share code, notes, and snippets.

Robin Smidsrød robinsmidsrod

Block or report user

Report or block robinsmidsrod

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
robinsmidsrod / gist:18a559af2680f85a72134a6d3093f62f
Last active Aug 22, 2019
BitDefender Rescue CD iPXE boot script (non-working because missing /bin/mount.nfs in initramfs)
View gist:18a559af2680f85a72134a6d3093f62f
echo Booting BitDefender Rescue ${bitdefender-version} x86 for ${initiator-iqn}
set base-url bitdefender-rescue-${bitdefender-version}/
kernel ${base-url}boot/kernel.i386-pc root=/dev/nfs nfsroot=${nfs-server}:${nfs-root}${base-url} ip=dhcp real_root=/dev/nfs loop=/rescue/livecd.squashfs looptype=squashfs livecd.nfsif=${netX/mac} initrd udev cdroot
initrd ${base-url}boot/initfs.i386-pc
boot || goto failed
goto start
robinsmidsrod / git-branch-sizes
Last active Aug 8, 2019
Output all non-merged refs in a git repo, ordered by number of changed lines in the diff output
View git-branch-sizes
# Output all non-merged refs in a git repo, ordered by number of changed lines in the diff output
git for-each-ref --shell --format="ref=%(refname)" --no-merged | \
while read entry
eval "$entry"
size=$(git diff -U0 "master...$ref" | grep -vP '^(diff|index|@@|\-\-\-|\+\+\+)' | wc -l)
View list_container_by_parent.sql
CREATE FUNCTION public.list_container_by_parent(in_parent_id uuid, in_locale text, in_sort_key text, in_custom_init_key text) RETURNS SETOF public.node
AS $$
-- Returns the child containers of the specified parent container in the
-- sort order specified by the sort key and locale.
-- If sort key is not specified, the sort key of the parent container,
-- or default for parent container type, is used.
-- If custom_init key is specified, containers that have this key set are
-- excluded from output. The value of the custom_init key doesn't matter.
View datatype_or_null.sql
CREATE FUNCTION public.datatype_or_null(data anyelement, datatype text)
RETURNS anyelement
AS $$
RETURN CAST(data AS datatype);
robinsmidsrod / file_listing.txt
Last active Aug 4, 2018
Saltstack formulas for deplying networkboot/dhcpd docker hub image for guest network using VLAN 6
View file_listing.txt
View gist:bd7fa6f19db694a5a4b7bbd5e500937a
[CRITICAL] Failed to load grains defined in grain file zfs.zfs in function <function zfs at 0x7f889d1dd398>, error:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/", line 756, in grains
ret = funcs[key]()
File "/usr/lib/python2.7/dist-packages/salt/grains/", line 116, in zfs
grains = salt.utils.dictupdate.update(grains, _zfs_pool_data(), merge_lists=True)
File "/usr/lib/python2.7/dist-packages/salt/grains/", line 102, in _zfs_pool_data
grains['zpool'][zpool[0]] = _conform_value(zpool[1], True)
IndexError: list index out of range
[ERROR ] Exception raised when processing __virtual__ function for Module will not be loaded: u'zfs_support'
robinsmidsrod / niclist_changes.diff
Last active Mar 21, 2018
Changes to iPXE util/ to avoid given/when warning and allow reverse sort on columns
View niclist_changes.diff
diff --git a/src/util/ b/src/util/
index 0600c823..2668a1c0 100755
--- a/src/util/
+++ b/src/util/
@@ -19,7 +19,7 @@ use Getopt::Long qw(GetOptions);
'help' => \( my $help = 0 ),
'format=s' => \( my $format = 'text' ),
- 'sort=s' => \( my $sort = 'bus,ipxe_driver,ipxe_name' ),
+ 'sort=s' => \( my $sort = 'bus-,ipxe_driver,ipxe_name' ),
robinsmidsrod / query.sql
Last active Feb 13, 2018
Trouble with large PostgreSQL statement because of unnest(ARRAY[ 'asdf', 'asdf' ])
View query.sql
checksums AS (
-- Using quote_string_array() DBD::Pg method here
-- Example: '0000218c2a23400651a308443664d18bc0639052', ..., '000031b775731a8bbd05c873d5dfab6db49e59c7' (and 150k more of those)
]) AS id
object_counts AS (
SELECT, count(*) AS object_count
robinsmidsrod / remove_given_when_util_niclist.diff
Created Feb 13, 2018
Fix issue with given/when experimental in newer Perl versions
View remove_given_when_util_niclist.diff
diff --git a/src/util/ b/src/util/
index 0600c823..f6e70e5b 100755
--- a/src/util/
+++ b/src/util/
@@ -50,23 +50,20 @@ Column names (default order):
# Only load runtime requirements if actually in use
-given($format) {
- when( /csv/ ) {
robinsmidsrod / proc_pidof_telegraf_limits.txt
Created Oct 31, 2017
Process limits for telegraf process which is having issues spawning processes (inputs.exec)
View proc_pidof_telegraf_limits.txt
# cat /proc/$(pidof telegraf)/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 15796 15796 processes
Max open files 65536 65536 files
You can’t perform that action at this time.