Skip to content

Instantly share code, notes, and snippets.

@jonfm
jonfm / gist:654c167eda826606babc5bddd9253b83
Created January 9, 2024 13:25
watch and rerun (osx)
#!/bin/zsh
set -uxo pipefail
FILE="./main.py"
fswatch -o "$FILE" | while read num; do
python ./main.py
done
@jonfm
jonfm / test
Created October 10, 2019 15:34
// authors: name
// books: title, publish_date
CREATE database library;
CREATE TABLE authors (author_id, name varchar(255))
CREATE TABLE books (id, author_id, title, publish_date)
SELECT authors.id, books.id FROM authors LEFT JOIN FROM authors, books ON authors.author_id = books.author_id
@jonfm
jonfm / script.py
Created September 20, 2018 12:41
template to count word frequency in a line of text
import pprint
pp = pprint.PrettyPrinter(indent=4)
filename = "./sample.txt"
with open(filename) as f:
content = f.readlines()
def word_frequency(text):
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwk4VihxXtsUysfuWBSQyGDPxTruLNz3JVIu9XWYNbBI+1CPu3KQz5Y4+wib3B2/lxczsPqlJhm1CvYcLyuIC/6bfZ/mUNn/SyUZvLFj55ieVu6tFGQhpJns58IcygFHmFfTvoPhef4hrJLUX2JNyS0+ioEir7THr7fXILg63zTFfG1dLWSvJD15yk5pFWfRO/NhY43moKTMlNLr+Q4NwUxuCOnPNYfkvu9A/R1soJdiAeGNkUGoXjmYGXbOXDn3w1nj6s75FoNp9hO/9P0KvJCHv1p9FfEIt9rWp9A5yRhPIocJ6xOWP7LxUs0W297qgB15f5f8KYEDW43MlGEwiH
@jonfm
jonfm / osx_install.sh
Last active March 14, 2018 10:13 — forked from t-io/osx_install.sh
Install most of my Apps with homebrew & cask
#!/bin/sh
# echo Install all AppStore Apps at first!
# # no solution to automate AppStore installs
# read -p "Press any key to continue... " -n1 -s
# echo '\n'
# echo Install and Set San Francisco as System Font
# ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
# echo Install Homebrew, Postgres, wget and cask
# ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
import Vue from 'vue' // What would this import?
import { Component } from 'react' // ...and this?
const router = require("./vue-ui/src/router") // ...and this?
new Vue({
el: '#app',
router,
template: '<App/>',
require "yaml"
require 'fileutils'
YAML_FRONT_MATTER_REGEXP = /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*\n?$)/m
def update_data(data)
key = "meta_description"
defaults = {
meta_description: nil
}