Skip to content

Instantly share code, notes, and snippets.

$ dig a benedicte.netlify.app # fra norge
; <<>> DiG 9.10.6 <<>> a benedicte.netlify.app
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57382
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
@benedicteb
benedicteb / find_orphaned_pkgs.py
Last active January 31, 2017 09:35
Script for finding pkg or dmg-files in a munki-repo that's not used in any pkginfo files.
#!/usr/bin/env python
"""
Usage:
./find_orphaned_pkgs.py
./find_orphaned_pkgs.py | grep -ie libreoffice | xargs rm # Remove all orphaned libreoffice pkgs
./find_orphaned_pkgs.py --munki-repo path/to/munki/repo
./find_orphaned_pkgs.py --count
"""
import argparse
@benedicteb
benedicteb / munki_fix_categories.py
Created March 22, 2016 09:29
This is a script for fixing categories in a munki repo. Call it with the path to your repo.
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
This is a script for fixing categories in a munki repo. Call it with the path to
your repo.
./munki_fix_categories.py fix --munki-repo path/to/munki/repo
It will set the same category on items with the same name. If there are items
not categorized after the fix and the interactive flag is not disabled the

Keybase proof

I hereby claim:

  • I am benedicteb on github.
  • I am benedebr (https://keybase.io/benedebr) on keybase.
  • I have a public key ASDI6tQKX8O_eJklU1PFmBNhNOOYS4nLtcIu3F5j4lMsLAo

To claim this, I am signing this object:

@benedicteb
benedicteb / pkgToDmg.py
Created January 12, 2016 11:03
Script for packaging a pkg into a dmg.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 2016-01-12 11:38
Short script for packaging a pkg into a dmg.
@author benediceb
"""
import sys
@benedicteb
benedicteb / args.py
Created March 16, 2015 16:56
argsexample
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 benedicte <benedicte@natalie>
#
# Distributed under terms of the MIT license.
"""
@benedicteb
benedicteb / lesefil.py
Last active August 29, 2015 14:16
Lese en fil
#!/usr/bin/env python
import re
sr_Q = r'Q-value\s*=\s*([0-9\.Ee+\-]+)\s*'
sr_mass = r'mass\s*=\s*([0-9\.Ee+\-]+)\s*'
sr_E = r'E-threshold\s*=\s*([0-9\.Ee+\-]+)\s*'
sr_energies = r'energies\s*=\s*([0-9\.Ee+\-]+)\s*'
filename = 'rp030065.tot'
infile = open(filename, 'r')