Skip to content

Instantly share code, notes, and snippets.

View maleghast's full-sized avatar

Oliver Godby maleghast

View GitHub Profile
@maleghast
maleghast / aoc2023_day2.clj
Created December 3, 2023 17:37
Advent of Code 2023 - Day 2 completed Clojure solution
(ns maleghast.aoc2023.day2
(:require [clojure.string :as str]
[clojure.java.io :as io])
(:gen-class))
(def colour-maximums {:blue 14 :green 13 :red 12})
(defn check-game-valid
[game-data]
(reduce
@maleghast
maleghast / aoc2023_day1.clj
Created December 1, 2023 17:34
AoC 2023 - Day 1
(ns maleghast.aoc2023.day1
(:require [clojure.string :as str]
[clojure.java.io :as io])
(:gen-class))
(defn first-and-last
[vec-of-nums-as-strings]
(str (first vec-of-nums-as-strings) (last vec-of-nums-as-strings)))
(defn numbers-as-text-to-digits
@maleghast
maleghast / form-3-functions.cljs
Created June 10, 2018 17:48
Example form-3 functions for redefining TreeMap in Recharts
(defn treemap-label
[]
(r/create-class
{:reagent-render (fn
[]
(let [props (r/props this)]
[:g
[:text
{:x (/ (+ (:x props) (:width props)) 2)
:y (+ (/ (+ (:y props) (:height props)) 2) 7)
@maleghast
maleghast / table_copy.md
Last active May 22, 2018 10:17
Aide Memoire for how to move / copy a table from one DB to another under PostgreSQL...

pg_dump -> psql

e.g.

  1. pg_dump -U [username] -h [hostname] -p [port number] -d [source database] -t [source_table] > [output_filename].sql

  2. cat [output_filename].sql | psql -U [username] -h [hostname] -p [port number] -d [target database]

If the [target database] already has the table that you want to copy, then run the pg_dump with a "-a" flag to dump 'data only'

@maleghast
maleghast / recent.git.alias.cmd
Created May 18, 2018 11:54
Git - Alias for recently committed branches
git config --global alias.recent "for-each-ref --format='%(refname:lstrip=2)' --sort=-committerdate refs/heads/ --count=5"
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
(resource
{:id ::index
:methods
{:post
{:consumes "application/octet-stream"
:consumer (fn [ctx _ body-stream]
(let [f (java.io.File/createTempFile "yada" ".tmp" (io/file "/tmp"))]
(infof "Saving to file: %s" f)
(save-to-file
ctx body-stream
@maleghast
maleghast / gist:0546ae26d81d1e40136b
Created March 11, 2016 07:31
Installing Composer (PHP package tool) on Amazon Linux
$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install

Keybase proof

I hereby claim:

  • I am maleghast on github.
  • I am olivergodby (https://keybase.io/olivergodby) on keybase.
  • I have a public key whose fingerprint is 5E75 076E 3E77 4AA7 514E 6ED8 2969 7477 D599 B31E

To claim this, I am signing this object:

@maleghast
maleghast / gist:1498a6533968dd8a3131
Created September 9, 2014 12:09
Development Configs for Kaleidoscope

#Development Configs for Kaleidoscope#

##kaleidoscope-broker##

###app.json###

{
    "external_dependencies": {},
    "secure_configuration": {},