Skip to content

Instantly share code, notes, and snippets.

@kevinfoerster
kevinfoerster / .eslintrc.js
Last active April 30, 2020 19:19
Generated by XState Viz: https://xstate.js.org/viz
module.exports = {
parser: 'babel-eslint',
env: {
browser: true,
es6: true,
node: true,
},
extends: ['plugin:react/recommended', 'airbnb'],
globals: {
Atomics: 'readonly',
// has articles, apple only
// const endpoint = 'https://www.mocky.io/v2/5e84a71e300000a73fcf4653';
// has articles, with samsung and apple
// const endpoint = 'https://www.mocky.io/v2/5e84dc35300000460a97ac9b';
// const endpoint = 'https://www.mocky.io/v2/5e9f5d792d00005300cb7b63';
// const coveragesEndpoint = 'https://www.mocky.io/v2/5e9f5d792d00005300cb7b63'
const endpoint = {
@kevinfoerster
kevinfoerster / machine.js
Last active April 10, 2020 21:47
Generated by XState Viz: https://xstate.js.org/viz
const process = {
env: {
GATSBY_FUNCTION_ENDPOINT: 'https://trinity-agency-dev-preview.kevinfoerster.com/.netlify/functions/auth/'
}
}
const fetchToken = (username, password) => {
const url = process.env.GATSBY_FUNCTION_ENDPOINT;
return fetch(url, {
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@kevinfoerster
kevinfoerster / ocrpdf.sh
Created March 12, 2019 13:29
this script is based on https://robservatory.com/find-and-fix-non-searchable-pdfs/, but includes OCRKit to OCR any pdfs found in the current working directory
#!/bin/bash
saveIFS=$IFS
IFS=$(echo -en "\n\b")
FilesToCheck=$(find `pwd` -maxdepth 99 -name "*.pdf")
for i in $FilesToCheck
do
errCheck=$(pdffonts ${i} 2>&1 | tail -1)
set file_path to POSIX path of theFile
set file_name to (do shell script "basename " & quoted form of file_path)
set file_name to do shell script "php -r 'echo trim(rawurlencode(" & "\"" & file_name & "" & "\"));'"
do shell script "echo 'http://dl.getdropbox.com/u/12345/'" & quoted form of file_name & "| pbcopy"
# coding: utf-8
require "rubygems"
require "mp3info"
filename = "Haendel--Messiah - Evry valley--.mp3"
content = Mp3Info.open(filename).tag.artist
Iconv.iconv('iso-8859-1', 'utf-8', content)
require "rubygems"
require "mp3info"
filename = "Haendel--Messiah - Evry valley--.mp3"
content = Mp3Info.open(filename).tag
puts content
puts "Händel"