Skip to content

Instantly share code, notes, and snippets.

View cbillowes's full-sized avatar
:octocat:

Clarice Bouwer cbillowes

:octocat:
View GitHub Profile
@cbillowes
cbillowes / SSH.md
Last active April 19, 2018 05:33
Get SSH to work on Windows for Github and BitBucket

Get SSH to work on Windows for Github and BitBucket

Install git

  • I chose native Windows Secure Channel Library
  • Previously I was having a lot of trouble getting setup. I am not sure if the SSL/TLS library caused this or not.

Using Git Bash

  • ssh-keygen with passphrase
@cbillowes
cbillowes / scrapbook.markdown
Last active April 22, 2018 16:07
Scrapbook

.bat to iterate through files and extract the first 10 characters from its name.

setlocal ENABLEDELAYEDEXPANSION

for %%f in (posts/*) do (
    set var=%%f
    @echo %var:~0,10%

)

@cbillowes
cbillowes / gremlins.clj
Last active July 21, 2018 03:03
A collection of errors and many silly mistakes to remind myself what I did to fix them next time.
; java.lang.RuntimeException: Unable to resolve symbol: catch in this context, compiling: <file>:<line>:<column>
; catch` is not a function or macro, it's special syntax only understood in the context of the special form `try`. You can't do this without writing your own form of try (see try+ in slingshot for an example of that).
; https://groups.google.com/forum/#!topic/clojure/4EN7RDbKqVE
; example - but still doesn't work in my code
; https://github.com/scgilardi/slingshot
(ns math.expression
(:require [tensor.parse]
@cbillowes
cbillowes / snippets.clj
Last active July 22, 2018 08:20
Nifty Snippets
; https://stackoverflow.com/questions/36032562/extract-values-from-vector-of-maps-conditionally-in-clojure
(map val (filter (comp #{:a} key) (apply concat vector-of-maps)))
; Grab URL from JavaScript window API
(ns awesome.stuff.to.learn
(:require [cemerick.url :as url]))
(defn [] (:anchor (url/url (-> js/window .-location .-href))))
; (compare-and-swap) function takes four arguments: an entity id, an attribute, an old value, and a new value.
@cbillowes
cbillowes / throwing-dice.js
Last active September 3, 2018 02:46
Throwing dice
(function () {
const dice = 3;
const variations = 6;
const point = 10;
function roll() {
let number = Math.round(Math.random() * variations);
return number ? number : 1;
}
@cbillowes
cbillowes / stopwatch.sh
Last active October 17, 2018 17:02
Stopwatch
#!/bin/bash
echo "Stopwatch"
date1=`date +%s`;
while true; do
echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r";
sleep 0.1
done
@cbillowes
cbillowes / unhide.sh
Last active October 11, 2018 16:26
Unhide linux files
#!/bin/bash
#print usage
if [ -z $1 ];then
echo "Usage :$(basename $0) parent-directory"
exit 1
fi
for name in $1/.*; do
if [ $(dirname "${name}") != "." ]; then
new_name="$(dirname ${name})/$(basename "${name}" | cut -c 2-)"
#!/bin/bash
echo "Countdown"
date1=$((`date +%s` + $1));
while [ "$date1" -ge `date +%s` ]; do
echo -ne "$(date -u --date @$(($date1 - `date +%s`)) +%H:%M:%S)\r";
sleep 0.1
done
@cbillowes
cbillowes / .spacemacs
Created August 21, 2019 08:57
Spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
@cbillowes
cbillowes / advanced-git.txt
Last active October 5, 2019 17:02
Advanced Git commands
# list all commits for a given file which includes cases where the file has been renamed.
git log --follow -- filename
# log with a decorated graph
git log --graph --abbrev-commit --decorate --date=relative --all
# short status on branch
git status --short --branch
# see log with diffs