Skip to content

Instantly share code, notes, and snippets.

View chip's full-sized avatar

Chip Castle chip

View GitHub Profile
@chip
chip / logging.rkt
Created May 24, 2023 20:56 — forked from Metaxal/logging.rkt
Simple usage of Racket's logging facility
#lang racket/base
; One way to define a logger
(define lg (make-logger 'my-logger))
; Define a receiver for this logger, along with a log level
(define rc (make-log-receiver lg 'error)) ; also try with 'debug
; Another way to define a logger, with additional forms
(define-logger lg2)
(define rc2 (make-log-receiver lg2-logger 'debug))
@chip
chip / alphametics.rkt
Created February 8, 2023 18:08
Solution to alphametics (aka cryptarithm) problem - Needs performance improvements
#lang racket
(provide solve)
(define (solve puzzle)
(define words (regexp-split #rx"==|[+]" (string-replace puzzle " " "")))
(define number-set (range 10))
(define individual-letters
@chip
chip / GIF-Screencast-OSX.md
Created February 24, 2022 21:10 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

{
"diagnostics.globals": [
"vim",
"describe",
"it",
"pending",
"before_each",
"after_each"
]
}
@chip
chip / example.app.vue
Created April 19, 2021 20:44 — forked from vonvick/example.app.vue
App.vue example
<template>
<div id="app">
<router-view></router-view>
<div class="refresh-container" v-if="hashChanged && $root.env !== 'development'">
<div class="notification-header">
<button type="button" class="close-refresh-modal" @click="closeModal" aria-label="Close">
<span aria-hidden="true"><i class="fal fa-times fa-sm"></i></span>
</button>
</div>
<div class="notification-body">
@chip
chip / refresh-page.mixin.js
Created April 19, 2021 20:44 — forked from vonvick/refresh-page.mixin.js
Mixin to be injected into App.vue
import axios from 'axios';
export const refreshPageMixin = {
data() {
return {
currentHash: '{{POST_BUILD_ENTERS_HASH_HERE}}',
token: localStorage.getItem('user-token'),
hashChanged: false,
newHash: ''
}
@chip
chip / example.package.json
Created April 19, 2021 20:43 — forked from vonvick/example.package.json
Vue.JS auto refresh package.json example file
{
"scripts": {
"build": "node build/build.js && npm run post:build",
"post:build": "node build/post-build.js"
},
}
@chip
chip / post-build.js
Created April 19, 2021 20:43 — forked from vonvick/post-build.js
Post Build file for creating hash version
const path = require('path');
const fs = require('fs');
const util = require('util');
// get application version from package.json
const appVersion = require('../package.json').version;
// promisify core APIs
const readDir = util.promisify(fs.readdir);
const writeFile = util.promisify(fs.writeFile);
@chip
chip / install-java.sh
Created June 11, 2018 19:53
HomeBrew Revert to Java8 from Java9
#!/usr/bin/env bash
set -e
# Uninstall Java 9 off the bat, so we can fix our local installation
if brew cask ls --versions "java" &>/dev/null; then
echo "Uninstalling Java"
brew cask uninstall java
fi
# Install jenv, java8 and java9
brew install jenv
brew cask install caskroom/versions/java8
@chip
chip / multiprocess_migration.sh
Created April 4, 2018 18:46 — forked from tanema/multiprocess_migration.sh
migrate files from gridfs to aws s3
#! /bin/bash
###################### USAGE ######################################
usage() {
echo "
Usage: mongotos3 [-t n] mongo_host mongo_collection s3_bucket
-t : number of parallel processes to use
mongo_host : the host of the mongodb server
mongo_collection : the collection to collecthe gridfs data from
s3_bucket : the name of the bucket you want to cp the files to
"