Skip to content

Instantly share code, notes, and snippets.

View rupert-madden-abbott's full-sized avatar

Rupert Madden-Abbott rupert-madden-abbott

View GitHub Profile
@rupert-madden-abbott
rupert-madden-abbott / Application.kt
Last active January 28, 2019 22:54
Lastpass -> HaveIBeenPwned Passwords Checker
import org.apache.commons.csv.CSVFormat
import java.io.FileReader
import java.net.HttpURLConnection
import java.net.URL
import java.security.MessageDigest
fun main(args: Array<String>) {
val allCredentials = CSVFormat.DEFAULT.withFirstRecordAsHeader().parse(FileReader("src/main/resources/temp.csv"))
.filter { row -> !row["password"].isNullOrBlank() }
.map { row -> LastPassSite(row["name"], row["url"], hash(row["password"])) }
@ConfigurationProperties (prefix = "meaningful.prefix")
@Validated
public class MeaningfulClassNameHereProperties {
/**
* The username to access meaningfulServiceNameHerePlease.
*/
@NotBlank
private String username;
/**
@Configuration
public class FirstDatabaseConfig implements EnvironmentAware {
private Environment env;
@Override
public void setEnvironment(final Environment env) {
this.env = env;
}
@Bean
@rupert-madden-abbott
rupert-madden-abbott / gist:2393399
Created April 15, 2012 15:19
rvm install trace with stable --ruby=rbx --gems=rails,puma
+ : 169 > export rvm_trace_flag=1
+ : 169 > rvm_trace_flag=1
+ : 174 > true 1 0 0 0 HOME=/home/rupert
+ : 178 > (( rvm_ignore_rvmrc == 0 ))
+ : 180 > for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
+ : 182 > [[ -s /etc/rvmrc ]]
+ : 180 > for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
+ : 182 > [[ -s /home/rupert/.rvmrc ]]
+ : 199 > [[ -z '' ]]
+ : 201 > (( UID == 0 ))
@rupert-madden-abbott
rupert-madden-abbott / app_template.rb
Created October 19, 2011 00:17
Rails App Template
system "rm -rf /tmp/app"
git clone: "git://gist.github.com/1296514.git /tmp/app"
# Rails Generators
application do
<<-EOS
config.generators do |g|
g.template_engine :haml
g.test_framework :rspec, fixture: true, views: false
g.integration_tool :rspec, fixture: true, views: true
@rupert-madden-abbott
rupert-madden-abbott / Gemfile
Created October 18, 2011 19:56
Rails App Builder
source 'http://rubygems.org'
gem 'rails', '3.1.1'
gem 'execjs'
gem 'therubyracer'
gem 'sqlite3'
gem 'haml-rails'
gem 'jquery-rails' # https://github.com/indirect/jquery-rails
gem 'simple_form' # rails generate simple_form:install
@rupert-madden-abbott
rupert-madden-abbott / gist:1138940
Created August 11, 2011 05:07
Ubuntu first time setup: synergy
# On server
sudo apt-get install synergy
# Enter into ~/.synergy.conf. Replace host_name and client_name with the hostnames of your computers. If some computers share hostnames, retain the default for the host
# and use an alias for the client later
# The links setup a circular pattern between two computers such that moving from the left or right of either screen makes you appear in the right place on the other screen.
# Customise to your preferences and number of computers.
section: screens
host_name:
client_name:
@rupert-madden-abbott
rupert-madden-abbott / gist:1138934
Created August 11, 2011 04:58
Ubuntu first time setup: .bashrc
# Add the following to ~/.bashrc
function parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function ps1_git() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/*\( .*\)/\1$(parse_git_dirty)/"
}
function ps1_rvm() {
[[ $(~/.rvm/bin/rvm-prompt g) != "@${PWD##*/}" ]] && echo "*"
@rupert-madden-abbott
rupert-madden-abbott / gist:1135027
Created August 9, 2011 19:58
Ubuntu first time setup: Rails Development
# After you have finished, you will have the latest version of rvm, Ruby MRI, Passenger and Rails setup and ready to go
# Install dependencies for rvm, ruby, passenger
sudo apt-get install curl git-core libcurl4-openssl-dev build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
# Optional: Install dependencies for capybara-webkit
sudo apt-get install libqt4-dev
# rvm http://beginrescueend.com/rvm/install/
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)