Skip to content

Instantly share code, notes, and snippets.

Lawrence Wachira LarryWachira

  • Nairobi, Kenya
Block or report user

Report or block LarryWachira

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davidpiesse
davidpiesse / tailwind_md_all_colours.js
Last active Sep 11, 2019
A colour set for Tailwind CSS that include all Material Design Colours, shades, accents and contrast colours
View tailwind_md_all_colours.js
// https://davidpiesse.github.io/tailwind-md-colours/
//
//Notes
//
//All colours are generated from Material Design Docs
//Colours have a base, a set of shades (50-900) accent colours
//In addition a companion set of contrast colours are included for colouring text / icons
// Example usage
// class="w-full bg-red-600 text-red-600-constrast"
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active Sep 7, 2019
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
View gist:ebaca117ac9e44231421f04e7796d5ca
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@dvdbng
dvdbng / vim-heroku.sh
Last active Oct 3, 2019
Run vim in heroku updated 2017
View vim-heroku.sh
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@caseywatts
caseywatts / quicktime-hangouts-recording.md
Last active Oct 15, 2019
Quicktime Hangouts Recording (using soundflower for audio)
View quicktime-hangouts-recording.md

Short link to this page: caseywatts.com/quicktime

Other gists & tricks: http://caseywatts.com/gists-and-tricks

Quicktime + Hangouts Recording

Scenario: You want to talk with someone over google hangouts (like for a user study), and you want to record BOTH:

  • the system output audio (from them)
  • the microphone audio (from you)
@JonCatmull
JonCatmull / smart-date.pipe.ts
Created Dec 21, 2016
Relative date Pipe for Angular2 + TypeScript . Convert date or timestamp into relative date string e.g. "5 days ago" or to local date string e.g. "11/12/2016"
View smart-date.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
import { DatePipe } from '@angular/common';
import { RelativeDatePipe } from './relative-date.pipe'; // https://gist.github.com/JonCatmull/e00afb1c96298a4e386ea1b5d091702a
const secondsInAday = 86400;
/*
* Turn Date into realtive date (e.g. "5 days ago") unless date is
* more than relativeMax days ago.
@JonCatmull
JonCatmull / relative-date.pipe.ts
Created Dec 21, 2016
Relative date Pipe for Angular2 + TypeScript . Convert date|timestamp into relative date string e.g. "5 days ago", "1 minute ago" etc.
View relative-date.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
// Epochs
const epochs: any = [
['year', 31536000],
['month', 2592000],
['day', 86400],
['hour', 3600],
['minute', 60],
['second', 1]
@absent1706
absent1706 / sqlalchemy-truncate_db.py
Last active Oct 14, 2019
Sqlalchemy: Truncate all tables
View sqlalchemy-truncate_db.py
def truncate_db(engine):
# delete all table data (but keep tables)
# we do cleanup before test 'cause if previous test errored,
# DB can contain dust
meta = MetaData(bind=engine, reflect=True)
con = engine.connect()
trans = con.begin()
con.execute('SET FOREIGN_KEY_CHECKS = 0;')
for table in meta.sorted_tables:
con.execute(table.delete())
@cecilemuller
cecilemuller / letsencrypt_2019.md
Last active Oct 20, 2019
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2019.md

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@pv8
pv8 / fix-venv.sh
Last active Sep 26, 2019
Fix virtualenv symlinks after upgrading python with Homebrew and running brew cleanup
View fix-venv.sh
#!/usr/bin/env bash
#
# Fix virtualenv symlinks after upgrading python with Homebrew and then running
# `cleanup`.
#
# After upgrading Python using Homebrew and then running `brew cleanup` one can
# get this message while trying to run python:
# dyld: Library not loaded: @executable_path/../.Python
# Referenced from: /Users/pablo/.venv/my-app/bin/python
# Reason: image not found
You can’t perform that action at this time.