Skip to content

Instantly share code, notes, and snippets.

Jan Ivar Beddari beddari

Block or report user

Report or block beddari

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
View vscode_literal_tab.json
{
"key": "ctrl+v tab",
"command": "type",
"args": { "text": "\t" },
"when": "editorTextFocus"
}
@beddari
beddari / ansible_when_truthy_test.yml
Created Mar 1, 2019 — forked from kcd83/ansible_when_truthy_test.yml
Test what vars evalute to true or false in Ansible 2.5
View ansible_when_truthy_test.yml
#!/usr/bin/env ansible-playbook
---
- name: Test truthiness
hosts: localhost
gather_facts: False
vars:
truthy_vars:
# TRUE
- True
- 1
View convert_filenames.py
#!/usr/bin/env python
# convert unicode filenames to pure ascii
import os
import sys
import glob
import unicodedata
EXT = u'*.*'
@beddari
beddari / recovery.txt
Created May 29, 2018 — forked from Millnert/recovery.txt
ceph recovery when FUBAR (mem / cpu looping crashing OSDs with OOM)
View recovery.txt
## Stop all OSDs
## Set OSD nodown
ceph osd set nodown
##Set OSD nobackfill
ceph osd set nobackfill
@beddari
beddari / format_list.py
Created Dec 2, 2017
Ansible list formatting filter_plugin
View format_list.py
def format_list(list_, pattern):
return [pattern % s for s in list_]
class FilterModule(object):
def filters(self):
return {
'format_list': format_list,
}
View learning.yaml
---
- name: test
hosts: localhost
connection: local
gather_facts: False
tasks:
# Test each key in a hash for existence, works fine ... I'll accept doing this!
- name: do something based on the existence of nested dict key nested.config.hash.key
debug: msg="{{ nested.config.hash.key }}"
@beddari
beddari / dict_merge.py
Created Oct 17, 2017 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python
View dict_merge.py
import collections
def dict_merge(dct, merge_dct):
""" Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
``dct``.
:param dct: dict onto which the merge is executed
:param merge_dct: dct merged into dct
View gist:6df04cb532a77e6cfd0a1bc70970575e
osadmin ()
{
source <(tpass show "openstack/$1/admin")
}
osuser ()
{
source <(tpass show "$(whoami)/openstack/$1")
}
View systemd.md

For the timer:

[Unit]
Description=Do something daily

[Timer]
OnCalendar=daily
Persistent=true

[Install]
You can’t perform that action at this time.