Skip to content

Instantly share code, notes, and snippets.

@segudev
segudev / invalid-m8-wavs.clj
Created January 11, 2023 13:55
babashka script to list .wav filepaths longer than 127 chars from a root dir
#!usr/bin/env bb
(require '[babashka.fs :as fs])
(let [abs-path (fs/absolutize (first *command-line-args*))
rel-path #(fs/relativize abs-path %)
folder-str (str (fs/file-name abs-path) "/")
path-with-folder #(str folder-str (rel-path %))
valid-m8? #(when (< 127 (count (path-with-folder %)))
(println (path-with-folder %)))
@segudev
segudev / 1-orgs-archetype.md
Created November 30, 2022 10:43 — forked from whatupfoo/1-orgs-archetype.md
Orgs and Teams Best Practices

Organization archetypes

The intention of this document is to provide some guidance and suggestions to customers who are wondering how they should structure organizations and teams in their GitHub Enterprise environment. The idea isn't to give hard and fast rules on which approach is better than the other, but to give examples of when one approach might be preferable to another depending on the use case.

1. A single organization with direct organization membership for repository access (not teams)

          ________________
          |     Org      |
          |    ______    |
          |   |      |\  |

| | Repo | \ |

@segudev
segudev / torrent-viewer.clj
Created July 13, 2021 13:53 — forked from zelark/torrent-viewer.clj
babashka script for viewing torrents files
#!/usr/bin/env bb
(require '[clojure.java.io :as io])
(require '[bencode.core :refer [read-bencode]])
(require '[clojure.walk :refer [prewalk]])
(require '[clojure.pprint :refer [pprint]])
(import 'java.io.PushbackInputStream)
(defn bytes->strings [coll]
(prewalk #(if (bytes? %) (String. % "UTF-8") %) coll))
@segudev
segudev / http-server.bb
Created July 9, 2021 00:19 — forked from holyjak/http-server.bb
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]
@segudev
segudev / 00_destructuring.md
Created July 4, 2021 12:41 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@segudev
segudev / ego_graph.py
Created June 23, 2020 11:56 — forked from davidADSP/ego_graph.py
ego_graph
import networkx as nx
# SAMPLE DATA FORMAT
#nodes = [('tensorflow', {'count': 13}),
# ('pytorch', {'count': 6}),
# ('keras', {'count': 6}),
# ('scikit', {'count': 2}),
# ('opencv', {'count': 5}),
# ('spark', {'count': 13}), ...]