Skip to content

Instantly share code, notes, and snippets.

View gmichokostas's full-sized avatar

Yiorgos Michokostas gmichokostas

View GitHub Profile
@jackrusher
jackrusher / webdav.clj
Last active November 1, 2023 22:07
A minimal webdav server/synthetic filesystem that works with JVM Clojure and babashka. See comments for instructions!
(ns webdav
(:require [clojure.string :as str]
[clojure.data.xml :as xml]
[org.httpkit.server :as hk-server]))
;; add the XML namespace that we'll use later
(xml/alias-uri 'd "DAV:")
(defn dissoc-in
"Should be in the standard library..."

OpenBSD logo     Rails logo     Falcon logo


Choose OpenBSD for your Unix needs. OpenBSD -- the world's simplest and most secure Unix-like OS. A safe alternatve to the frequent vulnerabilities and overengineering of Linux and related software (NGiNX & Apache (httpd-asiabsdcon2015.pdf), OpenSSL, iptables/nftables, systemd, BIND, Postfix, Docker etc.)

OpenBSD -- the cleanest kernel, the cleanest userland and the cleanest config

@belm0
belm0 / article_sc_and_lua_1.md
Last active September 21, 2023 06:37
Structured concurrency and Lua (part 1)

Structured concurrency and Lua (part 1)

John Belmonte, 2022-Sep

I've started writing a toy structured concurrency implementation for the Lua programming language. Some motivations:

  • use it as a simple introduction to structured concurrency from the perspective of Lua (this article)
  • learn the fundamental properties of structured concurrency and how to implement them
  • share code that could become the starting point for a real Lua library and framework

So what is structured concurrency? For now, I'll just say that it's a programming paradigm that makes managing concurrency (arguably the hardest problem of computer science) an order of magnitude easier in many contexts. It achieves this in ways that seem subtle to us—clearly so, since its utility didn't reach critical mass until around 2018[^sc_birth] (just as control structures like functions, if, and while weren't introduced to languages until long after the first compu

@mhitza
mhitza / vim-guile.md
Last active October 24, 2023 07:19
vim + GNU Guile development environment

This document was based on my local [GNU Guile][1]-3.0.5 setup. I'm not sure if it works as is with an older version of GNU Guile.

Because of a [dependency in Fedora][2] I had to compile GNU Guile from source release. As such, in your local setup the paths will differ. This is only relevant when defining the GUILE shell variable, and referencing the tags file in the vimrc.

Note that when building GNU Guile from source be sure that you have the readline-devel (or distro equivalent package) installed. That way the ./configure step will pick that up, and the ice-9 readline module will be usable.

@tenderlove
tenderlove / ngpng.rb
Last active December 12, 2020 14:09
Simple PNG generation example that only depends on zlib in Ruby
# Not Great PNG class. This is a very simple example of writing a PNG. It
# only supports colors from the color palette stored in `@palette`. This is
# meant to be example code, but I am using it in a program for visualizing
# heap dumps from Ruby.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
@mikeananev
mikeananev / jvm.clj
Last active March 29, 2023 12:42
Create JVM Heap Dump and Thread Dump using Clojure
;; Copyright (c) Mikhail Ananev, 2020.
;; Red Stars Systems (https://rssys.org).
;;
;; Licensed to the Apache Software Foundation (ASF) under one
;; or more contributor license agreements. See the NOTICE file
;; distributed with this work for additional information
;; regarding copyright ownership. The ASF licenses this file
;; to you 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
@JoshCheek
JoshCheek / json_parse.rb
Created April 22, 2020 20:43
Not sure why, but I suddenly felt compelled to make a JSON parser 🤷‍♂️
def json_parse(json)
success, index, _ws = json_parse_optional_whitespace(0, json)
success, index, value = json_parse_value(index, json)
raise "Could not parse" unless success
value
end
def json_parse_value(index, json)
%I[
json_parse_null
@finalfantasia
finalfantasia / shadow_cljs_and_fireplace_vim_integration.md
Last active March 8, 2023 19:10
Shadow-CLJS and Fireplace.vim Integration
  1. Create an app following the official Shadow-CLJS Quick Start instructions.
  2. Modify shadow-cljs.edn
;; shadow-cljs configuration
{:source-paths
 ["src/dev"
  "src/main"
  "src/test"]

 ;; ADD - CIDER middleware for nREPL (required by fireplace.vim)
@jhawthorn
jhawthorn / benchmark_first_request.rb
Last active September 10, 2019 17:55
Script to benchmark the initial request after a fork. Records stats and makes a flamegraph
REQUEST_URI = ARGV[0] || "http://0.0.0.0/"
REQUEST_OPTS = {
'REMOTE_ADDR' => "127.0.0.1",
'HTTP_HOST' => '0.0.0.0'
}
ARGV.clear
require "actionview_precompiler"
require "flamegraph"
require "./config/environment"
@ericnormand
ericnormand / 00_script.clj
Last active January 6, 2024 07:13
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='