Skip to content

Instantly share code, notes, and snippets.

View jackd942's full-sized avatar

Jack Davis jackd942

View GitHub Profile
@jackd942
jackd942 / PYTHON_DEFAULT.md
Created January 10, 2022 15:43 — forked from patrickmmartin/PYTHON_DEFAULT.md
update-alternatives for python3 on Ubuntu

Ubuntu 16 default python is almost python 3

Loads of solutions exist, but for changing the system default, alias is not the way to go.

$ update-alternatives --list python update-alternatives: error: no alternatives for python

@jackd942
jackd942 / install-zsh-windows-git-bash.md
Created May 31, 2021 16:42 — forked from fworks/install-zsh-windows-git-bash.md
Zsh / Oh-my-zsh on Windows Git Bash
@jackd942
jackd942 / git.migrate
Created February 19, 2021 14:56 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.

Phoenix 1.4.x to 1.5.0 upgrade instructions

Phoenix 1.5 requires Elixir >= 1.7. Be sure your existing version is up to date by running elixir -v on the command line.

Install the new phx.new project generator

$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.5.0
@jackd942
jackd942 / Shell Shortcuts
Last active March 21, 2020 20:04 — forked from acamino/README.md
Shortcuts to Improve Your Bash & Zsh Productivity
### Shortcut — Action
- [x] `CTRL + A` — Move to the beginning of the line
- [x] `CTRL + E` — Move to the end of the line
- [ ] `CTRL + [left arrow]` — Move one word backward (on some systems this is ALT + B)
- [ ] `CTRL + [right arrow]` — Move one word forward (on some systems this is ALT + F)
- [ ] `CTRL + U` — (bash) Clear the characters on the line before the current cursor position
- [ ] `CTRL + U` —(zsh) If you're using the zsh, this will clear the entire line
- [ ] `CTRL + K` — Clear the characters on the line after the current cursor position
- [ ] `ESC + [backspace]` — Delete the word in front of the cursor
@jackd942
jackd942 / gist:3fb67c79b30e15ea3701431d327ad3f7
Created July 17, 2019 01:26 — forked from arjunvenkat/gist:1115bc41bf395a162084
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.

@jackd942
jackd942 / _ticket-control.js
Created April 22, 2018 23:25 — forked from dmeents/_ticket-control.js
How to create a React.js ticketing system using Redux-Form and a MongoDB
//server/controllers/_ticket-control.js
'use strict';
const Tickets = require('../models/tickets');
//===================
// Create Tickets Route
//===================
exports.createTicket = function(req, res, next) {
@jackd942
jackd942 / dupe-finder.js
Created January 17, 2017 19:27 — forked from chrisckchang/dupe-finder.js
Aggregation query to find duplicate key values
// Desired unique index:
// db.collection.ensureIndex({ firstField: 1, secondField: 1 }, { unique: true})
db.collection.aggregate([
{ $group: {
_id: { firstField: "$firstField", secondField: "$secondField" },
uniqueIds: { $addToSet: "$_id" },
count: { $sum: 1 }
}},
{ $match: {