Skip to content

Instantly share code, notes, and snippets.

View robinsmidsrod's full-sized avatar

Robin Smidsrød robinsmidsrod

View GitHub Profile
@robinsmidsrod
robinsmidsrod / remove_given_when_util_niclist.diff
Created February 13, 2018 09:26
Fix issue with given/when experimental in newer Perl versions
diff --git a/src/util/niclist.pl b/src/util/niclist.pl
index 0600c823..f6e70e5b 100755
--- a/src/util/niclist.pl
+++ b/src/util/niclist.pl
@@ -50,23 +50,20 @@ Column names (default order):
EOM
# Only load runtime requirements if actually in use
-given($format) {
- when( /csv/ ) {
@robinsmidsrod
robinsmidsrod / proc_pidof_telegraf_limits.txt
Created October 31, 2017 11:51
Process limits for telegraf process which is having issues spawning processes (inputs.exec)
# 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
@robinsmidsrod
robinsmidsrod / vbox_named_config.diff
Last active September 27, 2017 14:01
Updated VirtualBox named configuration that works with iPXE commit 74d90b33 (almost everything is disabled now)
diff --git a/src/config/vbox/general.h b/src/config/vbox/general.h
index 06b45f1a..aceae74f 100644
--- a/src/config/vbox/general.h
+++ b/src/config/vbox/general.h
@@ -1,12 +1,17 @@
/* Disabled from config/defaults/pcbios.h */
+#undef IMAGE_ELF
+#undef IMAGE_MULTIBOOT
+#undef IMAGE_BZIMAGE
@robinsmidsrod
robinsmidsrod / console.h
Created June 5, 2017 20:23
iPXE console.h customization for useful logging to syslog
/* Everything but LOG output to BIOS console */
#undef CONSOLE_PCBIOS
#define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG )
#define CONSOLE_VESAFB
/* Everything but TUI output to syslog console */
#undef CONSOLE_SYSLOG
#define CONSOLE_SYSLOG ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )
#undef LOG_LEVEL
1c1
< (CASE pc.parent_sort_key
---
> (CASE COALESCE(pc.parent_sort_key)
6c6
< (CASE pc.parent_sort_key
---
> (CASE COALESCE(pc.parent_sort_key)
11c11
< (CASE pc.parent_sort_key
CREATE OR REPLACE FUNCTION public._compute_container_sort_key (
in_container_id uuid
)
RETURNS text AS
$body$
WITH container_default_sort_key AS (
SELECT * FROM (VALUES
('folder', 'index_asc'),
('album', 'index_asc'),
('blog', 'updated_desc')
SELECT
c.container_id AS id
FROM container c
JOIN container_tree ct ON ct.child_container_id = c.container_id
WHERE ct.parent_container_id = 'dec521e1-432e-4304-8ba8-6cf59590d99b'
ORDER BY
CASE COALESCE( 'index_asc', _compute_container_sort_key('dec521e1-432e-4304-8ba8-6cf59590d99b') )
WHEN 'index_asc' THEN c.sort_number ASC NULLS LAST, collkey(c.title, 'nb_NO') ASC
WHEN 'index_desc' THEN c.sort_number DESC NULLS FIRST, collkey(c.title, 'nb_NO') DESC
WHEN 'size_asc' THEN c.sort_number ASC NULLS LAST, collkey(c.title, 'nb_NO') ASC -- same as index_asc
WITH container_default_sort_key AS (
SELECT * FROM (VALUES
('folder', 'index_asc'),
('album', 'index_asc'),
('blog', 'updated_desc')
) AS kv (container_type, default_sort_key)
)
SELECT COALESCE(NULLIF(NULLIF(c.sort_key, ''), 'default'), cdsk.default_sort_key) AS container_sort_key
FROM container c JOIN container_default_sort_key cdsk USING(container_type)
WHERE c.container_id = '6b6c8837-f3e5-4e63-a42b-5c07fd4b56ad';
disable_vmbus_time_sync_on_startup:
file.line:
- name: /etc/rc.local
- match: "/usr/local/sbin/vmbus_time_sync disable"
- content: "/usr/local/sbin/vmbus_time_sync disable"
- mode: ensure
- before: "exit 0\n"
SELECT (
-- Check access for objects
'container' = 'object' AND ( -- in_type
SELECT EXISTS (
-- Owner has all rights
SELECT 1
FROM object o
WHERE o.object_id = '82195a7e-86a2-4235-bcd6-126492273e64' -- in_element_id
AND o.owner_id = '86d09109-64cc-4aa6-9336-b49b8ae71f2c' -- in_account_id
) OR EXISTS (