Skip to content

Instantly share code, notes, and snippets.

Martin Klepsch martinklepsch

Block or report user

Report or block martinklepsch

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
@martinklepsch
martinklepsch / README.md
Last active Mar 25, 2020
A very minimal Emacs configuration to get started with Emacs & Evil-mode
View README.md

A Starting Point for using Emacs & Evil-mode

(I wrote a bit about why Emacs and Vim on my blog and thought it might be nice to give some starting point for people that want to try it.)

If you just want to play around with Emacs & Evil mode do the following:

  1. mkdir ~/.emacs.d/
  2. copy init.el into ~/.emacs.d/
  3. Download Emacs from http://emacsformacosx.com
View reagent-autoscroll.cljs
;; Auto-scrolling ==============================================================
(defn scroll! [el start end time]
(.play (goog.fx.dom.Scroll. el (clj->js start) (clj->js end) time)))
(defn scrolled-to-end? [el tolerance]
;; at-end?: element.scrollHeight - element.scrollTop === element.clientHeight
(> tolerance (- (.-scrollHeight el) (.-scrollTop el) (.-clientHeight el))))
(defn autoscroll-list [{:keys [children class scroll?] :as opts}]
@martinklepsch
martinklepsch / client.clj
Last active Jan 30, 2020
A minimal Clojure client for Airtable.com's HTTP API.
View client.clj
(ns oxygen.client
"A minimal Clojure client for Airtable.com's HTTP API.
Supports retrieval of whole tables as well as individual records.
Dependencies: [org.clojure/data.json \"0.2.6\"] [clj-http \"2.0.0\"]"
(:require [clojure.data.json :as json]
[clojure.string :as string]
[clojure.set :as set]
[clj-http.client :as client]))
(def api-base "https://api.airtable.com/v0")
@martinklepsch
martinklepsch / login_blocking.markdown
Last active Oct 10, 2019
`login` blocking indefinitely
View login_blocking.markdown

More context: https://twitter.com/martinklepsch/status/810483946597158912

$ sudo dtruss login
dtrace: system integrity protection is on, some features will not be available
dtrace: failed to execute login: dtrace cannot control executables signed with restricted entitlements

In my ~/.tmux.conf I had a line like this:

set-option -g default-command "reattach-to-user-namespace -l fish"
@martinklepsch
martinklepsch / boot_sentry.clj
Created May 15, 2019
Boot tasks and helper functions to create Sentry releases and attach source maps to them
View boot_sentry.clj
(ns dev.boot-sentry
(:require [boot.util :as util]
[boot.core :as boot]
[clojure.data.json :as json]
[org.httpkit.client :as http]))
(def sentry-key "abc")
(def org "my-org")
(def project "frontend")
(def test-release "test-release-delete-me")
@martinklepsch
martinklepsch / fritzbox_reconnect.py
Created Apr 22, 2010
Simple script to reconnect your fritz.box
View fritzbox_reconnect.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Instruct an AVM FRITZ!Box via UPnP_ to reconnect.
This is usually realized with tools like Netcat_ or cURL_. However, when
developing in Python_ anyway, it is more convenient to integrate a native
implementation. This one requires Python_ 2.5 or higher.
UPnP_ (Universal Plug and Play) control messages are based on SOAP_, which is
@martinklepsch
martinklepsch / README.md
Last active Nov 12, 2018
Notes about fixing https://cljdoc.org analysis issues with ClojureScript 1.10.439 https://github.com/cljdoc/cljdoc/issues/201
View README.md

How to analyze-file with foreign-lib dependencies?

  • I'm trying to figure out how to analyze a file that depends on react (via CLJSJS)
  • Previously cljdoc.org would analyze with *analyze-deps* set to false
  • With 1.10.439 this no longer works. (Dynamic vars can't be resolved, see old description below)
  • With *analyze-deps* set to true I need to properly supply the foreign lib information but I can't figure out how.

Solution

When calling cljs.analyzer.api/analyze-file with the state-as-first-arg arity it calls cljs.env/with-compiler-env which shadowed my own binding described in Current Approach section. I was unaware that analyzer.api/empty-state is actually just a compiler env as well so creating the right compiler env and passing it to analyze-file solved all issues:

View sqlite-index-not-used.md
SQLite version 3.24.0 2018-06-04 14:10:15
Enter ".help" for usage hints.
sqlite> .schema
CREATE TABLE stats (
  date        TEXT,
@martinklepsch
martinklepsch / logging.cljc
Last active Oct 22, 2018
simple Clojurescript logging using Google Closure logging tools
View logging.cljc
;; This previously was CLJX but has now been updated to use cljc. Thanks @caskolkm
;; https://gist.github.com/caskolkm/39d823f5bac7051d3062
(ns app.logging
(:refer-clojure :exclude [time])
(:require #?(:clj [clojure.tools.logging :as log]
:cljs [goog.log :as glog]))
#?(:cljs (:import goog.debug.Console)))
#?(:cljs
View pathom-cljdoc.clj
(ns cljdoc.pathom3
(:require [com.wsscode.pathom.core :as p]
[com.wsscode.pathom.connect :as pc]
[clojure.core.async :as async]
[clojure.set]
[cljdoc.util.repositories :as repos]
[cljdoc.util.pom :as pom]
[cljdoc.config :as config]
[cljdoc.storage.sqlite-impl :as cljdoc-sqlite]))
You can’t perform that action at this time.