Skip to content

Instantly share code, notes, and snippets.

ag -G '\.rb$' --no-multiline -l '(^|^[^#]*(\s+|\.))(module_|class_|instance_)?eval(\s|\()' |
awk -F/ '{ count[$1]++ } END { for(tld in count) print tld ": " count[tld]; } ' |
sort -n -k 2 -r
class ClassMethodClient
def self.get_thing
"thing"
end
def self.put_thing(thing)
nil
end
end
#### these options use the eigenclass ####
## def on an identifier
my_object = Object.new
def my_object.foo
puts "foo"
end
@packrat386
packrat386 / atomic_kotlin.md
Created March 20, 2023 00:28
My extended notes on Atomic Kotlin

Atomic Kotlin

Picked up a book cause that worked for C++ and Ruby

I: Programming Basics

Introduction

It wants me to skip the first section if I'm experienced but I kinda don't want to?

#!/usr/bin/env ruby
require_relative './kv_logger.rb'
logger = KVLogger.new(STDOUT)
logger.info "sup"
logger = logger.with_tags(tag: 'info')
logger.warn "with tags!"
@packrat386
packrat386 / git-unhook
Created January 13, 2023 19:00
git command to remove hooks
#!/usr/bin/env bash
GIT_ROOT=$(git rev-parse --git-dir)
rm -rf ${GIT_ROOT}/hooks/*
@packrat386
packrat386 / rubocop-diff
Created January 13, 2023 18:52
run rubocop on diff
#!/usr/bin/env bash
bundle exec rubocop --force-exclusion --only-recognized-file-types -A $(git diff --name-only $(git merge-base develop HEAD) | xargs -I _ bash -c 'if test -f _; then echo _; fi')
@packrat386
packrat386 / alert.json
Created January 5, 2023 02:49
Sample alert for boreas
// curl https://api.weather.gov/alerts/active?point=40.7892,-124.1645
{
"@context": [
"https://geojson.org/geojson-ld/geojson-context.jsonld",
{
"@version": "1.1",
"wx": "https://api.weather.gov/ontology#",
"@vocab": "https://api.weather.gov/ontology#"
}
@packrat386
packrat386 / functional_oop.go
Created December 19, 2022 16:42
Much Ado About Wallets
package main
import (
"fmt"
)
// an object is a function that returns its methods, which have names
type object func() map[string]method
type method func(args ...interface{}) []interface{}
@packrat386
packrat386 / nitter-docker-network.service
Last active April 25, 2022 18:39
nitter in docker in systemd
[Unit]
Description=Create docker network for nitter
Conflicts=umount.target
Requires=systemd-udevd.service
After=systemd-udevd.service
Before=nitter-server.service
Before=nitter-redis.service
[Service]
Type=oneshot