Skip to content

Instantly share code, notes, and snippets.

View jcpsantiago's full-sized avatar
🏊

João Santiago jcpsantiago

🏊
View GitHub Profile
@subpath
subpath / berlin_kitas.csv
Last active July 22, 2024 10:09
Berlin's Kitas with addresses and emails (csv file with ";" as separator)
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 1 column, instead of 4. in line 2.
address;name;type;postcode;phone;email;educational;topics;languages;lat;lon
Wartenburgstr. 7;Ev. Kirchengemeinde Jesus-Christus;Kindertagesstätte;10963;030216 30 87;Kita@jckg.berlin;;;;52.49654;13.38089
Wilhelmstr. 15;Trauminsel e.V.;Eltern-Initiativ-Kindertagesstätte;10963;030-25923697;trauminsel.ev@hotmail.de;Situationsansatz;Ästhetische Bildung (Musik und Kunst), Gesundheit, Interkulturelle Pädagogik, Körper und Bewegung;deutsch - arabisch;52.50275;13.38865
Wilhelmstr. 54;Kinder im Kiez gGmbH;Kindertagesstätte;10963;030208 92 14;franzoesischestrasse@kinder-im-kiez.de;;;;52.4985969;13.3783562
Dessauer Str. 27;Orte für Kinder GmbH;Kindertagesstätte;10963;0302639 7930;traumbaum@ortefuerkinder.de;;;;52.50369999999999;13.3791
Hornstr. 13;EMMA gemeinnützige GmbH;Kindertagesstätte;10963;03054849986;post@EMMAAPFEL.de;Montessori-Pädagogik;;;52.49478;13.38017
Wilhelmstr. 3;Trauminsel e.V.;Eltern-Initiativ-Kindertagesstätte;10963;030-25938954;trauminsel.ev@hotmail.de;Situationsansatz;Ästhetische Bildung (Musik und Ku
@jackrusher
jackrusher / seq-primer.clj
Created June 1, 2021 12:55
Condensed visual tutorial in #Bauhaus style for a subset of the #Clojure seq API (inspired by similar JS tweets)
(def ■ '■)
(def ▲ '▲)
(def ● '●)
(first [● ■ ▲]) ; ●
(second [● ■ ▲]) ; ■
(nth [● ■ ▲] 2) ; ▲
(rest [● ■ ▲]) ; (■ ▲)
(last [● ■ ▲]) ; ▲
(butlast [● ■ ▲]) ; (● ■)
@holyjak
holyjak / http-server.bb
Last active June 5, 2024 10:00
Babashka HTTP server for serving static files, similar to `python -m http.server` but more flexible :)
#!/usr/bin/env bb
#_" -*- mode: clojure; -*-"
;; Based on https://github.com/babashka/babashka/blob/master/examples/image_viewer.clj
(ns http-server
(:require [babashka.fs :as fs]
[clojure.java.browse :as browse]
[clojure.string :as str]
[clojure.tools.cli :refer [parse-opts]]
[org.httpkit.server :as server]
@malcolmsparks
malcolmsparks / backup-photos.clj
Last active June 29, 2021 19:10
A babashka script for sorting and de-duping a photo collection on Linux.
#_( ;; Allow this script to be executed directly
"exec" "bb" -o "--classpath" "." "$0" "$@"
)
;; Copyright © 2020, Malcolm Sparks
;; Permission is hereby granted, free of charge, to any person obtaining a copy
;; of this software and associated documentation files (the “Software”), to deal
;; in the Software without restriction, including without limitation the rights
;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@borkdude
borkdude / scrape_tables.clj
Created October 5, 2020 08:21
Extract HTML tables with babashka and bootleg
(ns scrape
(:require [babashka.pods :as pods]
[clojure.walk :as walk]))
(pods/load-pod "bootleg") ;; installed on path, use "./bootleg" for local binary
(require '[babashka.curl :as curl])
(def clojure-html (:body (curl/get "https://en.wikipedia.org/wiki/Clojure")))
@borkdude
borkdude / foo.html
Last active December 9, 2020 11:58
Prism Clojure highlighting
<html>
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism-tomorrow.min.css" rel="stylesheet" />
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js"></script>
<pre>
<code class="language-clojure">
(defn foo []
@roman01la
roman01la / clojurescript-repl-workflow.md
Last active October 22, 2022 12:07
ClojureScript REPL Workflow

ClojureScript REPL Workflow

Short write up on using REPL when developing UIs in ClojureScript.

Hot-reload on save or Eval in REPL?

Everyone's standard approach to hot-reloading is to use a tool (Figwheel or shadow-cljs) that reloads changed namespaces automatically. This works really well: you change the code, the tool picks up changed files, compiles namespaces and dependants, notifies REPL client which then pulls in compiled changes, and re-runs a function that re-renders UI.

The other approach is to use ClojureScript's REPL directly and rely only on eval from the editor. This more or less matches Clojure style workflow. This approach might be useful when you don't want tools overhead or hot-reloading becomes slow for you or you just used to this style of interactions. Also changing code doesn't always mean that you want to reload all the changes. On the other hand it is very easy to change a couple of top-level forms and forget to eval one of them.

(ns appliedsciencestudio.covid19-clj-viz.repl
(:require [clojure.string :as string]
[hickory.core :as hick]
[hickory.select :as s]))
;;;; Scraping data
(def wiki-page
"We want this data, but it's only published as HTML."
(slurp "https://en.wikipedia.org/wiki/List_of_countries_by_hospital_beds"))
# Takes an ordered vector of numeric values and returns a small bar chart made
# out of Unicode block elements. Works well inside dplyr mutate() or summarise()
# calls on grouped data frames.
sparkbar <- function(values) {
span <- max(values) - min(values)
if(span > 0 & !is.na(span)) {
steps <- round(values / (span / 7))
blocks <- c('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█')
paste(sapply(steps - (min(steps) - 1), function(i) blocks[i]), collapse = '')

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg