Skip to content

Instantly share code, notes, and snippets.

@hindol
hindol / Function.java
Last active October 7, 2022 19:15
Writing Azure Functions in Clojure
package com.github.hindol.clj_fn.core;
import clojure.lang.*;
import com.microsoft.azure.functions.*;
import com.microsoft.azure.functions.annotation.*;
public final class Function implements Functional, IType
{
public static final Object const__0;
@didibus
didibus / user.clj
Created January 29, 2020 04:20
A Clojure user.clj file which lets you lazy load certain namespace at the REPL
(def safe-requires
"List of namespaces to require and refer when inside user ns at load time.
Can be given an initialization body to execute after having been required.
To do so, wrap the lib spec in a vector, and all elements after the lib
spec vector will be evaled after the lib spec has been required."
'[[clojure.repl :as repl :refer (source apropos dir pst doc find-doc)]
[clojure.java.javadoc :as javadoc :refer (javadoc)]
[clojure.pprint :as pprint :refer (pp pprint)]
[clojure.stacktrace :as stacktrace :refer (e)]
@MichaelSimons
MichaelSimons / RetrievingDockerImageSizes.md
Last active March 25, 2024 11:14
Retrieving Docker Image Sizes

Retrieving Docker Image Sizes

There are two metrics that are important to consider when discussing the size of Docker images.

  1. Compressed size - This is often referred to as the wire size. This affects how fast/slow images can be pulled from a registry. This impacts the first run experience on machines where images are not cached.
  2. Uncompressed size - This is often referred to as the size on disk. This affects how much local storage is required to support your Docker workloads.

The example commands shown below will work on Windows, MacOS, and Linux.

How to Measure the Compressed Size

@DavidLutton
DavidLutton / kindle.py
Last active January 16, 2024 19:29
Make use of a Kindle as a ePaper display
import time
from datetime import datetime
from textwrap import wrap
import requests
from requests_html import HTMLSession
import paramiko
import schedule
def get_traffic(road):
@eyarz
eyarz / commit-msg-hook.py
Last active December 15, 2021 17:57
Git commit-msg hook to verify commit message convention => https://datree.io/blog/git-commit-message-conventions-for-readable-git-log/
#!/usr/bin/env python
"""
Git commit hook:
.git/hooks/commit-msg
Check commit message according to guidelines
"""
import sys
import re
# This is a blocklist to block samsung smart tv's sending meta data at home.
# Please help to collect domains!
# It could be that the TV does not receive any more updates or other services no longer work. Please report such an incident.
# https://gist.github.com/Perflyst/315f86393712a0c2107ee8eb58c6acee
0.0.0.0 device-metrics-us.amazon.com
0.0.0.0 samsungacr.com
0.0.0.0 samsungcloudsolution.com
0.0.0.0 samsungcloudsolution.net
0.0.0.0 pavv.co.kr
@fnky
fnky / ANSI.md
Last active May 2, 2024 15:51
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@mtnygard
mtnygard / deps.edn
Last active April 9, 2024 11:51 — forked from athos/deps.edn
Friendly REPL. Run with `clojure -Sdeps '{:deps {hello-clojure {:git/url "https://gist.github.com/mtnygard/9b2dd3c88b3309d82210b84f33ee954d" :sha "774314af2d28261af4a52ac270136d5ba21ff046"}}}' -m frenpl`
{:paths ["." "src" "test"]
:deps {expound {:mvn/version "0.8.4"}
clansi {:mvn/version "1.0.0"}
cider/cider-nrepl {:mvn/version "0.24.0"}
refactor-nrepl {:mvn/version "2.5.0"}
com.bhauman/rebel-readline {:mvn/version "0.1.4"}}}
@jart
jart / blakefiler.py
Last active September 18, 2023 16:22
Turns bazel query --output=build //tensorflow:libtensorflow_framework.so into isomorphic Makefile
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@levand
levand / data-modeling.md
Last active May 19, 2023 16:38
Advice about data modeling in Clojure

Since it has come up a few times, I thought I’d write up some of the basic ideas around domain modeling in Clojure, and how they relate to keyword names and Specs. Firmly grasping these concepts will help us all write code that is simpler, cleaner, and easier to understand.

Clojure is a data-oriented language: we’re all familiar with maps, vectors, sets, keywords, etc. However, while data is good, not all data is equally good. It’s still possible to write “bad” data in Clojure.

“Good” data is well defined and easy to read; there is never any ambiguity about what a given data structure represents. Messy data has inconsistent structure, and overloaded keys that can mean different things in different contexts. Good data represents domain entities and a logical model; bad data represents whatever was convenient for the programmer at a given moment. Good data stands on its own, and can be reasoned about without any other knowledge of the codebase; bad data is deeply and tightly coupled to specific generating and