Skip to content

Instantly share code, notes, and snippets.

View kyptin's full-sized avatar

Jeff Terrell kyptin

View GitHub Profile
@aconz2
aconz2 / live-reload.sh
Last active November 3, 2022 13:12
simple way to get live reloading browser. Pipe list of filenames that will trigger a refresh (see entr)
#!/usr/bin/env bash
trap 'kill $(jobs -pr) 2>/dev/null' SIGINT SIGTERM EXIT
browser=chromium-browser
python3 -m http.server &
$browser "http://localhost:8000/$1" 2>/dev/null &
browserpid=$!
@JanSellner
JanSellner / MeasureTime.py
Last active January 13, 2023 21:57
Measure Time in Python
from timeit import default_timer
class MeasureTime(object):
"""
Easily measure the time of a Python code block.
>>> import time
>>> with MeasureTime() as m:
... time.sleep(1)
Elapsed time: 0 m and 1.00 s
@jacobobryant
jacobobryant / deploy.cljs
Created May 10, 2019 19:31
Script for automating Datomic Cloud Ion push + deploy
#!/usr/bin/planck
(ns deploy.core
(:require [cljs.reader :refer [read-string]]
[planck.shell :as shell]))
(defn sh [& args]
(let [result (apply shell/sh args)]
(if (= 0 (:exit result))
(:out result)
(throw (ex-info (:err result) {})))))
@gfredericks
gfredericks / all-these-class-files.org
Last active February 11, 2023 01:22
Some of the sources for my Clojure/conj 2018 slides

What Are All These Class Files Even About?, and Other Stories

Latex Prelude

@brycemcd
brycemcd / five_tips_for_thinking_in_clojure.md
Last active February 1, 2020 23:32
Five Tips For Thinking in Clojure

5 Tips for Thinking in Clojure

Sent by the Pragmatic Programmers, LLC. • 9650 Strickland Rd Ste 103-255• Raleigh NC 27615 - Feb. 21st, 2018

  1. Rely on your REPL. Clojure (like other LISP languages) intends to provide a "live" development experience where you are actively manipulating and testing the program while you develop the code. To take full advantage of Clojure, it's essential to work in a development environment that allows you to interactively evaluate parts of your code while you develop. We are fortunate to have a variety of tool choices in Clojure that can satisfy those demands.
  2. Maps, not Objects. Developers coming from object-oriented languages are likely to look for the ability to create classes or objects to hold their data. Clojure takes a more direct and flexible approach to data, primarily storing information attributes in heterogenous maps. Rather than providing class-specific interfaces, Clojure provides a single generic data interface for creating, accessing, and transforming att
@reborg
reborg / frequencies-rf-xform.clj
Last active November 19, 2017 17:06
Explorations around frequencies as a reducing function for transducers, sequential or parallel.
(require '[criterium.core :refer [quick-bench]])
(require '[clojure.core.reducers :as r])
(import '[java.util HashMap Collections Map]
'java.util.concurrent.atomic.AtomicInteger
'java.util.concurrent.ConcurrentHashMap)
(set! *warn-on-reflection* true)
;; 500k maps with the same key. value are overlapping 1/5 of the time.
(def data
(into []
(require '[clojure.set :as set])
(def info
[{:year 2017
:month 4
:data "x"}
{:year 2017
:month 4
:data "y"}
@kyptin
kyptin / steps.md
Last active October 16, 2023 06:22
Accessing a rails console in Google App Engine (flexible)

If you're running a Rails app in Google App Engine's flexible environment, it takes a bit of setup to get to a rails console attached to your deployed environment. I wanted to document the steps for my own reference and also as an aid to others.

  1. Open the Google App Engine -> instances section of the Google Cloud Platform (GCP) console.

  2. Select the "SSH" drop-down for a running instance. (Which instance? Both of my instances are in the same cluster, and both are running Rails, so it didn't matter for me. YMMV.) You have a choice about how to connect via ssh.

    1. Choose "Open in browser window" to open a web-based SSH session, which is convenient but potentially awkward.

    2. Choose "View gcloud command" to view and copy a gcloud command that you can use from a terminal, which lets you use your favorite terminal app but may require the extra steps of installing the gcloud command and authenticating the gcloud command with GCP.

@rduplain
rduplain / README.md
Last active April 10, 2019 01:48
Code Quarterly's 2011 Q&A with Rich Hickey, by Michael Fogus

From the Archives: Code Quarterly's 2011 Q&A with Rich Hickey

Rich Hickey is frequently quoted as saying:

You can reach a point with Lisp where, between the conceptual simplicity, the large libraries, and the customization of macros, you are able to write only code that matters. And, once there, you are able to achieve a very high degree of focus, such as you would when playing Go, or playing a musical instrument, or meditating. And then, as with those activities, there can be a feeling of elation that accompanies that mental state of focus.

@reborg
reborg / rich-already-answered-that.md
Last active May 5, 2024 04:45
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content