Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@nick-f
nick-f / .vimrc
Created April 16, 2019 21:55
Vim mappings for running PHPUnit tests
" Run the whole test suite
nnoremap <leader>TS :!./vendor/bin/phpunit<cr>
" Run all tests in the current file
nnoremap <leader>T :!./vendor/bin/phpunit %<cr>
" Place your cursor within the test function to run a single test
" Need to install https://github.com/tyru/current-func-info.vim
function! RunPhpUnitTest()
let testFunction=cfi#format("%s", "")
@nick-f
nick-f / open-on-github.sh
Created October 9, 2017 22:17
Shell function to open the current repo's GitHub page
alias gho=githubOpen
function githubOpen() {
if [ ! -d .git ] ;
then echo "ERROR: This isnt a git directory" && return false;
fi
git_url=`git config --get remote.origin.url`
if [[ "${git_url}" == git@github* ]]; then
if [[ "${git_url}" == *.git ]]; then
@nick-f
nick-f / laravel-spark-metrics-dummy-data.php
Created December 1, 2016 05:39
Generate random data for Laravel Spark metrics to show off the graphs
Route::get('/metricsdummy', function() {
for ($i = 0; $i < 100; $i++) {
DB::table('performance_indicators')->insert([
'monthly_recurring_revenue' => mt_rand(1000, 2000),
'yearly_recurring_revenue' => mt_rand(50000, 60000),
'daily_volume' => mt_rand(100, 300),
'new_users' => mt_rand(50, 100),
'created_at' => Carbon\Carbon::now()->subDays($i),
'updated_at' => Carbon\Carbon::now()->subDays($i),
]);
@nick-f
nick-f / laravel-mail-preview-route.php
Created December 1, 2016 05:37
Laravel route for previewing Notification emails in the browser (credit to @adamwathan)
Route::get('mail-preview', function() {
$message = (new App\Notifications\TrialExpiring(Auth::user()))->toMail(Auth::user());
return view($message->view[0], $message->data());
});
@nick-f
nick-f / Download images from my Instagram profile easily.md
Created July 26, 2016 14:57
Download images from my Instagram profile easily

Hi future me,

Here's how I past me downloaded all of my Instagram photos easily. Remember, it doesn't download likes, comment, or any other information apart from the photos themselves.

For whatever reason Photoshop doesn't want to open the images but Preview works fine. It's the same when I manually downloaded the photos from the Instagram website. (Sabotage?)

And of course everyone else who isn't you will stop reading at this point and not use the instructions, right? Good. Now that it's just us...

Requirements

  • wget

Find MD5 Fingerprint of public key

In OpenSSH version 6.8, the default format for fingerprints was changed from MD5 to SHA256. Meanwhile, GitHub's SSH Keys page still lists the fingerprints as a MD5 hash.

The following outputs the fingerprint as a MD5 hash to allow for easy comparison to GitHub's fingerprint.

ssh-keygen -l -f /path/to/key.pub -E md5
@nick-f
nick-f / keybase.md
Created November 3, 2014 01:30
Keybase.io verification

Keybase proof

I hereby claim:

  • I am nick-f on github.
  • I am nickf (https://keybase.io/nickf) on keybase.
  • I have a public key whose fingerprint is 96CE 8131 998B 6DA8 129E D83D 459F 2707 6695 EE21

To claim this, I am signing this object: