Skip to content

Instantly share code, notes, and snippets.

View PEZ's full-sized avatar
🎯
Focusing

Peter Strömberg PEZ

🎯
Focusing
View GitHub Profile
@PEZ
PEZ / poly_crash.c
Created December 28, 2013 21:00
Drawing polygons on Pebble SDK2 Beta 4 bites me. Running this on Helco's Pebble Simulator - https://github.com/Helco/PebbleLocalSim - draws a nice and tidy triangle (just using 100 points to do it). Running it on my pebble draws some crazy stuff. Moreover, setting NUM_POINTS to 400 causes my pebble to reset and sometimes even enter recovery mode.
#include <pebble.h>
static Window *window;
static Layer *poly_layer;
const int NUM_POINTS = 100;
// Draws a simple triangle, just using many points
static GPath *create_poly_path(int num_points) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Creating poly path with %d points.", num_points);
@PEZ
PEZ / tasks.json
Created March 7, 2018 19:45
VS Code extension npm tsak
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
// A task runner that calls a custom npm script that compiles the extension.
{
@PEZ
PEZ / launch.json
Created March 7, 2018 19:46
VS Code extension development launch config
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
@PEZ
PEZ / cljs.core.js
Created December 13, 2018 14:36
From a release build of calva-lib
var window=global;var $CLJS=require("./cljs_env");require("./goog.math.long.js");require("./goog.math.integer.js");require("./goog.string.string.js");require("./goog.object.object.js");require("./goog.array.array.js");require("./goog.uri.uri.js");require("./goog.string.stringbuffer.js");
var cljs$cst$keyword$ns,cljs$cst$symbol$root,cljs$cst$symbol$default_DASH_dispatch_DASH_val,cljs$cst$symbol$mseq,cljs$cst$symbol$defrecord_STAR_,cljs$cst$keyword$val,cljs$cst$symbol$_meta,cljs$cst$symbol$js_STAR_,cljs$cst$symbol$__hash,cljs$cst$symbol$ns_STAR_,cljs$cst$symbol$ascending_QMARK_,cljs$cst$symbol$fqn,cljs$cst$symbol$update_DASH_count,cljs$cst$symbol$off,cljs$cst$symbol$cnt,cljs$cst$keyword$status,cljs$cst$keyword$descendants,cljs$cst$symbol$nil_DASH_val,cljs$cst$symbol$dispatch_DASH_fn,
cljs$cst$symbol$start,cljs$cst$symbol$new,cljs$cst$symbol$all,cljs$cst$symbol$prev_DASH_seed,cljs$cst$symbol$first,cljs$cst$symbol$tail,cljs$cst$symbol$method_DASH_cache,cljs$cst$symbol$ci,cljs$cst$keyword$alt_DASH_impl,cljs$cst$sy
@PEZ
PEZ / tween.cljc
Created March 5, 2019 22:20
Adaption of tween function to use requestAnimationFrame
(ns tween
"Simple tweening of values inside a map atom.")
(defn easeOutQuad
[elapsed-t duration]
(let [dt (/ elapsed-t duration)]
(* dt (- 2 dt))))
(defn easeLinear
[elapsed-t duration]
@PEZ
PEZ / Hello.md
Created January 24, 2020 17:34
Testing @-ref

Tagging @ericnormand and @pez

@PEZ
PEZ / calva ctrl+shift keybindings.json
Last active April 12, 2020 08:18
Alternative Calva keybindings, for keyboard layouts where `ctrl+alt` is `altgr`
// Alternative Calva keybindings, for keyboard layouts where `ctrl+alt` is `altgr`
// * Using `ctrl+shift` instead of `ctrl+alt`
// Calva: https://github.com/BetterThanTomorrow/calva
// Paste the contents of the top level array into the correspning array in your `keybindings.json` file.
// (You can open that file easily using the *Preferences: Open Keyboard Shortuts (JSON)* command in vscode.)
[
{
"command": "calva.tellAboutNewChordingKey",
"key": "ctrl+shift+v",
"when": "editorLangId == clojure"
@PEZ
PEZ / UIControl+ListenBlock.swift
Created September 20, 2017 23:04
Swift3 UIControl extension for adding block event listeners. Adapted from: https://stackoverflow.com/a/44917661/44639
import Foundation
import UIKit
extension UIControl {
func listen(_ action: @escaping () -> (), for controlEvents: UIControlEvents) -> AnyObject {
let sleeve = ClosureSleeve(attachTo: self, closure: action, controlEvents: controlEvents)
addTarget(sleeve, action: #selector(ClosureSleeve.invoke), for: controlEvents)
return sleeve
}
@PEZ
PEZ / aoc2020-day-4.clj
Last active December 4, 2020 22:13
Day 4, step 2, of Advent of Code 2020, using Clojure and coljure.spec. Not refactored or tidied up 😀.
(ns pez.aoc2020.day-4
(:require [clojure.string]
[clojure.spec.alpha :as s]
[pez.aoc2020.util :as util]))
(defn parse [card]
(->> (clojure.string/replace card #"\s" " ")
(re-seq #"(\S+):(\S+)")
(map rest)
(reduce
error 09:59:45.583077+0100 tccd identifier=com.obsproject.obs-studio, pid=4507, auid=501, euid=501, binary_path=/Applications/OBS.app/Contents/MacOS/obs attempted to call TCCAccessRequest for kTCCServiceAccessibility without the recommended com.apple.private.tcc.manager.check-by-audit-token entitlement
default 09:59:45.583406+0100 tccd AUTHREQ_ATTRIBUTION: msgID=4507.4, attribution={accessing={identifier=com.crowdcafe.windowmagnet, pid=2122, auid=501, euid=501, binary_path=/Applications/Magnet.app/Contents/MacOS/Magnet}, requesting={identifier=com.obsproject.obs-studio, pid=4507, auid=501, euid=501, binary_path=/Applications/OBS.app/Contents/MacOS/obs}, },
default 09:59:45.605627+0100 runningboardd Acquiring assertion targeting [app<application.com.obsproject.obs-studio.36873184.36873740(501)>:4507] from originator [daemon<com.apple.coreservices.launchservicesd>:101] with description <RBSAssertionDescriptor| "frontmost:4507" ID:177-101-1605 target:4507 attributes:[
<RBSDomainAttribute| domain:"com.apple.laun