Skip to content

Instantly share code, notes, and snippets.

View dcj's full-sized avatar

Don Jackson dcj

View GitHub Profile
@aroemers
aroemers / app.clj
Last active January 15, 2021 20:25
Component-lite
(ns app
(:require [lifecycle :refer [combine parallel]]))
(defn components [app-config]
(combine (parallel (users-db/component)
(tasks-db/component))
(rest-api/component app-config)))
@mhzawadi
mhzawadi / pi_version.sh
Last active July 16, 2019 15:14
Get the Pi model
#!/bin/sh
# https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
cpuinfo=`cat /proc/cpuinfo | grep "Revision"|awk -F': ' '{printf $2}'`
model=`cat /sys/firmware/devicetree/base/model`
case ${cpuinfo} in
"0002" )
echo "Revision : 0002 (Model B Rev 1, 256MB)" ;;
"0003" )
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@zelark
zelark / pg_test.types.clj
Last active February 2, 2024 19:47
Support json and jsonb Postgres types in Clojure.
;; For supporting more PG types, see https://github.com/remodoy/clj-postgresql
(ns pg-test.types
(:require [cheshire.core :as json]
[clojure.java.jdbc :as jdbc])
(:import [org.postgresql.util PGobject]
[java.sql PreparedStatement]))
;; Writing
(defn- to-pg-json [data json-type]
@yageek
yageek / Simplify.swift
Created June 14, 2018 12:40 — forked from lachlanhurst/Simplify.swift
Simplification of a 3D polyline using the Ramer–Douglas–Peucker algorithm in Swift
//
// Simplify.swift
//
// Simplification of a 3D-polyline.
// A port of https://github.com/hgoebl/simplify-java for Swift
//
//
// The MIT License (MIT)
//
// Created by Lachlan Hurst on 10/02/2015.
@humeji
humeji / list-all-repos.py
Created January 30, 2018 17:17 — forked from ralphbean/list-all-repos.py
Script to list all repos for a github organization
#!/usr/bin/env python
""" Print all of the clone-urls for a GitHub organization.
It requires the pygithub3 module, which you can install like this::
$ sudo yum -y install python-virtualenv
$ mkdir scratch
$ cd scratch
$ virtualenv my-virtualenv
@SlightlyLoony
SlightlyLoony / port.c
Last active July 27, 2022 06:01
Raspbian program to set U-Blox GPS to stationary mode, and save configuration
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
/*
Simple program that sets stationary mode in U-Blox GPS connected to serial 0 on a Raspberry Pi 3 running Jessie. This
was not tested on any other system. This program assumes the GPS is using its default 9600 baud, 8 data bits, 1 stop bit,
and no parity. I'm using the expansion board from Uputronics.
This program worked for me when I set up my Pi as a stratum 1 NTP server per the directions on this
@purcell
purcell / migrations.sql
Last active September 16, 2017 10:10
PostgreSQL schema migrations system
This code now lives in its own repo at https://github.com/purcell/postgresql-migrations
@dghubble
dghubble / kubeception.md
Last active April 24, 2024 18:29
Running QEMU/KVM and Nested Kubernetes on Bare-Metal Kubernetes
@cgrand
cgrand / core.cljc
Last active October 14, 2020 12:18
Mixing macros and code in cljc and supporting clj, cljs and self-hosted cljs, see https://github.com/cgrand/macrovich
;; SEE: https://github.com/cgrand/macrovich
;; macros and code in a single cljc working across clj, cljs and self-hosted cljs
;; require clojurescript from master
(ns foo.core
#?(:cljs (:require-macros
[net.cgrand.meta-macros :refer [macros no-macros]]
[foo.core :refer [add]])
:clj (:require