Skip to content

Instantly share code, notes, and snippets.

View bapti's full-sized avatar

Neil Crawford bapti

  • Sketch
  • Scotland
View GitHub Profile
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = crlf
insert_final_newline = true
@bapti
bapti / dns-sync.sh
Created October 28, 2019 08:37 — forked from regisbsb/dns-sync.sh
Init.d script for keeping WSL resolv.conf in-sync with Windows
#! /bin/bash
### BEGIN INIT INFO
# Provides: dns-sync
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Synchronizes /etc/resolv.conf in WLS with Windows DNS - Matthias Brooks
### END INIT INFO
const fs = require("fs");
const csvData = fs.readFileSync("./src/data/search-results.csv", "utf8");
const [header, ...rows] = csvData.split("\n");
const keys = header.split("|");
const rowsAsArrays = rows.map((row) => row.split("|"));
const searchResults = rowsAsArrays.map((row) => {
return {
@bapti
bapti / roman_numeral_1.ex
Last active April 11, 2022 12:00
Arabic to Roman Numeral converter in elixir
defmodule RomanNumeralFirstPass do
def convert(value) do
sum =
String.graphemes(value)
|> convert_numerals()
|> Enum.sum()
{:ok, sum}
end
@bapti
bapti / git_clear_history.sh
Created April 13, 2022 17:04 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@bapti
bapti / useful.sh
Last active August 19, 2022 15:04
Useful shell defaults
export HISTFILE=~/.zsh-history
export SAVEHIST=10000
export HISTSIZE=10000
export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_file_bytes 1024000"
export PATH="$PATH:/opt/homebrew/bin/"
export PATH="$PATH:~/.asdf/shims/"