Skip to content

Instantly share code, notes, and snippets.

View andywerner's full-sized avatar

Andy Werner andywerner

  • JobNinja
  • Munich, Germany
View GitHub Profile
@sdesalas
sdesalas / Async.gs
Last active December 19, 2024 04:33
Asynchronous execution for Google App Scripts (gas)
/*
* Async.gs
*
* Manages asyncronous execution via time-based triggers.
*
* Note that execution normally takes 30-60s due to scheduling of the trigger.
*
* @see https://developers.google.com/apps-script/reference/script/clock-trigger-builder.html
*/
@BOSSoNe0013
BOSSoNe0013 / i2cdetect.py
Last active June 28, 2022 22:09
Simple i2cdetect clone written in Python 3 with smbus library
import sys
import smbus
first = 0x03
last = 0x77
def i2cdetect(bus_id=0):
bus = smbus.SMBus(bus_id)
print('Bus: I2C-{}'.format(bus_id))
@angstwad
angstwad / dict_merge.py
Last active December 22, 2024 16:02
Recursive dictionary merge in Python
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
@ttscoff
ttscoff / font_grabber.rb
Last active February 20, 2025 09:34
Give it a <link> from Google fonts and get back CSS with fonts embedded
#!/usr/bin/ruby
# encoding: utf-8
# Grab google web fonts and embed them as base64 data URIs
# <http://brettterpstra.com/2015/03/14/embedding-google-web-fonts/>
require 'base64'
if ARGV.length > 0
input = ARGV
elsif STDIN.stat.size > 0
input = STDIN.read.strip.split(/\n+/)
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';