Skip to content

Instantly share code, notes, and snippets.

@ukdave
ukdave / session_cookie_migrator.rb
Created January 10, 2024 14:48
Rails session cookie migrator
@ukdave
ukdave / date_add_to_mod.c
Created October 11, 2023 20:18
Program to set the Date Added attribute of a file to it's modified date on macOS
/*
* This code was written by Stefan Schmidt from this Stack Exchange post:
* https://apple.stackexchange.com/questions/40941/how-to-set-date-added-metadata-in-mac-os-x-10-7-lion#answer-457371
*
* Tested by me on macOS Bug Sur 11.7.10
*
* To compile:
*
* gcc -o date_add_to_mod date_add_to_mod.c
*
@ukdave
ukdave / adfs_saml_request.xml.erb
Created June 9, 2023 15:51
Ruby Sharepoint SAML federated authentication
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue</a:Action>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1"><%= to %></a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<o:UsernameToken u:Id="uuid-7b105801-44ac-4da7-aa69-a87f9db37299-1">
<o:Username><%= username.encode(xml: :text) %></o:Username>
@ukdave
ukdave / extensions.json
Created December 4, 2019 13:25
vscode for ruby
{
"recommendations": [
"kaiwood.endwise",
"castwide.solargraph",
"lourenci.go-to-spec",
"thadeu.vscode-run-rspec-file",
"alexkrechik.cucumberautocomplete",
"sianglim.slim",
"dbaeumer.vscode-eslint",
@ukdave
ukdave / vscode.json
Last active December 20, 2021 08:32
My VS Code user settings
{
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
// "editor.fontLigatures": "'ss02', 'ss19'",
"editor.rulers": [120],
"editor.tabSize": 2,
"editor.minimap.enabled": false,
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active",
@ukdave
ukdave / Vagrantfile
Created January 5, 2018 08:55
My global Vagrant configuration (~/.vagrant.d/Vagrantfile)
Vagrant.configure("2") do |config|
# Use the vbguests coming with the box image
if Vagrant.has_plugin?('vagrant-vbguest')
config.vbguest.auto_update = false
end
# Use linked clones to save disk space and import time
config.vm.provider "virtualbox" do |v|
v.linked_clone = true
end
@ukdave
ukdave / config.cson
Created December 3, 2017 09:32
Atom config
"*":
"activate-power-mode":
autoToggle: false
plugins:
playAudio: true
screenShake: true
"atom-beautify":
general:
"atom-package-deps":
ignored: []
@ukdave
ukdave / Makefile
Created October 11, 2017 11:53
Makefile for go projects
all: vet test build ok
vet:
$(call announce,"Running vet")
go vet ./...
test:
$(call announce,"Running tests")
go test ./...
@ukdave
ukdave / pimp-my-shell.txt
Last active April 22, 2022 09:58
Pimp my shell
# Install oh-my-zsh
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# Install powerlevel 10k theme:
$ git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
$ brew tap homebrew/cask-fonts
$ brew install --cask font-hack-nerd-font
# Add this to ~/.zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"
@ukdave
ukdave / style.less
Created September 8, 2017 07:37
Atom ansible syntax theme
// colours from one-dark-syntax theme
@mono-1: hsl(220, 14%, 71%); // default text
@hue-1: hsl(187, 47%, 55%); // <-cyan
@hue-2: hsl(207, 82%, 66%); // <-blue
@hue-3: hsl(286, 60%, 67%); // <-purple
@hue-4: hsl( 95, 38%, 62%); // <-green
@hue-5: hsl(355, 65%, 65%); // <-red 1
@hue-5-2: hsl( 5, 48%, 51%); // <-red 2
@hue-6: hsl( 29, 54%, 61%); // <-orange 1