Skip to content

Instantly share code, notes, and snippets.

View LondonAppDev's full-sized avatar

Mark Winterbottom LondonAppDev

View GitHub Profile
slava-vishnyakov /
Last active June 24, 2024 12:42
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

 * Matches following attributes in Markdown-typed image: [, alt, src, title]
microcipcip / redux.js
Last active March 4, 2019 11:55
Redux simple implementation
function createStore(reducer, initialState) {
let state = initialState;
const listeners = [];
const subscribe = listener => listeners.push(listener);
const getState = () => state;
const dispatch = action => {
state = reducer(state, action);
listeners.forEach(l => l());
chrisdpa-tvx / athena.rst
Last active March 20, 2022 06:28
Create an Athena database, table, and query

All Your Data Does Not Belong In a Database

Businesses are machines producing mountains of data about sales, usage, customer, costs, etc... Traditionally data processing is highly centralised with teams of staff and computer running hot a whirling ready to process. We can do better than moving the mountain of data into the corporate data machine - so long as that machinary is light enough to be moved to the data.

Don't move the mountain - Bring the processing to the data

We've had this problem; a huge directory of files in CSV format, conataining vital information for our business. But it's in CSV, requires analysis, and don't you don't feel like learning sed/grep/awk today - besides it's 2017 and no-one thinks those tools are easy to use.

LondonAppDev /
Created February 7, 2017 08:19
Python REST API script
#!/usr/bin/env bash
# Update the apt repos.
sudo apt-get update
# Install required dev packages.
sudo apt-get install -y language-pack-en
sudo apt-get install -y python3-dev python-pip python-dev
# Install virtualenvwrapper
roadrunner2 / 0
Last active June 21, 2024 14:47
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)


This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se

danieleggert / GPG and git on
Last active June 6, 2024 09:29
How to set up git to use the GPG Suite

GPG and git on macOS


No need for homebrew or anything like that. Works with and the command line.

  1. Install -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
chrisbodhi /
Last active June 8, 2024 11:52
A summary of the tips & tricks in Cal Newport's "Deep Work"

Deep Work

Rules for Focused Success in a Distracted World

Cal Newport, 2016 [purchase it at half-price books]

Part I: The Idea

  • Deep Work is valuable
  • Deep Work is rare
  • Deep Work is meaningful
amalgjose /
Last active January 4, 2022 19:02
This is a very simple python code snippet for calculating the difference between two dates or timestamps. This will calculate the difference in terms of number of years, months, days, hours, minutes etc. For more details, refer
__author__ = 'Amal G Jose'
from datetime import datetime
from dateutil import relativedelta
##Aug 7 1989 8:10 pm
date_1 = datetime(1989, 8, 7, 20, 10)
##Dec 5 1990 5:20 am
date_2 = datetime(1990, 12, 5, 5, 20)
hgomez /
Last active December 11, 2023 07:47
Mass install/update of Jenkins Plugins

Scripted Jenkins Plugins install

Jenkins has a very rich catalog of plugins and it's quite easy to install and update them via UI. BTW, when you want to add tons of plugin via UI, it's a fairly long and boring procedure.

Hopefully, mass installation (or update) could be easy using a simple bash script (curl/python required) :

Create a file containing plugins to be installed (or updated), ie iplugins :

gustavohenke / svg2png.js
Created February 18, 2014 15:27
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {