Skip to content

Instantly share code, notes, and snippets.

@ExFed
ExFed / zorder.groovy
Last active March 16, 2024 19:52
Z-Order Curve
#!/usr/bin/env groovy
ztoc = { int d, int z ->
if (0 == d) {
return []
}
if (1 == d) {
return [z]
}
@ExFed
ExFed / gossip.groovy
Last active October 3, 2023 10:14
Stupid Gossip Network
#!/usr/bin/env groovy
import groovy.transform.*
import java.util.concurrent.atomic.*
@Immutable(knownImmutableClasses = [InetSocketAddress])
class Peer {
private static final SELF_HOSTS = (InetAddress.getAllByName('localhost') as List
+ InetAddress.localHost
@ExFed
ExFed / lineage.clj
Last active November 2, 2023 03:53
Clojure Lineage Macro
(defmacro linas->
"Similar to clojure.core/as->; returns a vector of intermediate values."
[expr name & forms]
(let [linn `lin#]
`(let [~name ~expr
~linn [~name]
~@(interleave (repeat name) (butlast forms) (repeat linn) (repeat `(conj ~linn ~name)))]
~(if (empty? forms)
[name]
`(conj ~linn ~(last forms))))))
0x00 There once was a coder named Jax
0x20 Who wrote his programs in Emacs.
0x40 The heap overflowed?
0x60 His "elegant" code
0x80 Was chock-full of realloc hacks!
@ExFed
ExFed / wsl-fix-netipinterfaces.ps1
Last active January 18, 2022 19:39 — forked from nfekete/wsl-fix-resolvconf.sh
Fix resolv.conf in Windows Subsystem for Linux, when WSL doesn't correctly generate it.
Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect"} | Set-NetIPInterface -InterfaceMetric 4000
Get-NetIPInterface -InterfaceAlias "vEthernet (WSL)" | Set-NetIPInterface -InterfaceMetric 1
@ExFed
ExFed / SeqVariant.java
Last active March 27, 2021 21:51
Variant Types in Java (using Lombok and Vavr)
package com.columnzero.util.function;
import io.vavr.Function1;
import io.vavr.PartialFunction;
import io.vavr.collection.Seq;
import io.vavr.collection.Stream;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import java.util.function.Predicate;
@ExFed
ExFed / gstruct_binding_compiler.groovy
Last active January 11, 2021 20:45
gStruct Binding PoC
import groovy.transform.Canonical
import groovy.transform.CompileStatic
interface Type {}
@CompileStatic
@Canonical
class Ref implements Type {
String name
Type type
@ExFed
ExFed / biz_props.gradle
Last active February 27, 2019 04:11
Gradle Sub-Project Property Overrides
// biz/props.gradle
project.ext.fullName = 'biz baz'
@ExFed
ExFed / build.gradle
Created February 26, 2019 14:39 — forked from LindsayBradford/build.gradle
Gradle script for LaTeX pdf generation.
/*
* Usage:
* all LaTeX source files go in $rawDirectory
* base document to 'cook' should match content of $latexFile
* build script delivers resulting PDF file to $cookedDirectory
*/
defaultTasks 'full'
ext { documentBase = 'myBaseLaTeXFileName' }

Keybase proof

I hereby claim:

  • I am exfed on github.
  • I am exfed (https://keybase.io/exfed) on keybase.
  • I have a public key ASCyCfxUVyNBiYwcdZ_k8PU6Ja4i3p6x-Zj_FiGPZbAu1wo

To claim this, I am signing this object: