Skip to content

Instantly share code, notes, and snippets.

View metmajer's full-sized avatar

Martin Etmajer metmajer

View GitHub Profile
@michaelsauter
michaelsauter / ODS3.md
Last active January 16, 2020 08:39
ODS 3.0

Work Packages for OpenDevStack 3.0

Release timeline: May 2020. Theme: Quality

Shared Library Testing

Owner(s): ? / Size: M / Benefit: Reliable pipelines, more confidence in changes / Ticket(s): #149, #146

Write automated tests for the shared library. Could be a mixed of tests with mocks and E2E tests. Run e.g. in Travis or Github Actions.

Project Provisioning Testing

@MichalZalecki
MichalZalecki / docx2pdf.py
Created July 8, 2017 08:09
Converting DOCX to PDF using Python
import sys
import subprocess
import re
def convert_to(folder, source, timeout=None):
args = [libreoffice_exec(), '--headless', '--convert-to', 'pdf', '--outdir', folder, source]
process = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout)
filename = re.search('-> (.*?) using filter', process.stdout.decode())

Git Cheat Sheet

Commands

Getting Started

git init

or

FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr']
def human_log(res):
if type(res) == type(dict()):
for field in FIELDS:
if field in res.keys():
encoded_field = res[field].encode('utf-8')
print '\n{0}:\n{1}'.format(field, encoded_field)
# This gist is compatible with Ansible 1.x .
# For Ansible 2.x , please check out:
# - https://gist.github.com/dmsimard/cd706de198c85a8255f6
# - https://github.com/n0ts/ansible-human_log
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@ept
ept / gist:4475995
Last active November 4, 2022 08:38
Syntax highlighting code for PowerPoint (Mac OS)

How to add syntax-highlighted code to PowerPoint slides (Mac OS)

  1. pygmentize -f rtf FILE | pbcopy
  2. Paste into TextEdit (in rich text mode: Format → Make Rich Text before pasting), and copy to clipboard again.
  3. In PowerPoint, Edit → Paste Special… → Styled Text.

(Pasting RTF directly into PowerPoint doesn't work correctly, at least with PowerPoint 2008 — it extends colour spans longer than it should, and sometimes removes line breaks. Going via TextEdit seems to solve the problem.)

@mbostock
mbostock / README.md
Last active June 7, 2023 18:33
Underscore’s Equivalents in D3

Collections

each(array)

Underscore example:

_.each([1, 2, 3], function(num) { alert(num); });
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@jgallen23
jgallen23 / bookmarklet.js
Created July 26, 2011 00:57
The Hit List Bookmarklet
javascript:var addTask=function(a,b,c,d,e){window.location="thehitlist:///"+c+"/tasks?method=POST&title="+encodeURIComponent(a)+"&url="+encodeURIComponent(b)+"&startDate="+d+"&priority="+e};addTask(document.title,window.location,"inbox","t")
@Gozala
Gozala / extend-array.js
Created November 7, 2010 17:10
Array subclass ES5
// No need to sub class Array if what you need is just an extended
// array. Example below illustrates the way to extend Array.
function SubArray() {
return Object.defineProperties(Array.prototype.slice.call(arguments), SubArrayDescriptor)
}
SubArray.prototype = Array.prototype
var SubArrayDescriptor =
{ constructor: { value: SubArray }
, last: { value: function last() {