Skip to content

Instantly share code, notes, and snippets.

@dcvezzani
dcvezzani / led-with-potentiometer.c.ino
Last active April 30, 2018 03:37
My latest musings with an Arduino
#include <math.h>
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the Serial Monitor.
Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu).
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
@dcvezzani
dcvezzani / vue-setup-custom.sh
Last active April 26, 2018 01:52
I would like to customize my vuejs app; I do so after the project has been scaffolded. Perl is wonderful for string replacements like this.
vue init webpack sudoku
cd sudoku
yarn add bulma node-sass sass-loader
mkdir src/assets/sass
touch src/assets/sass/main.scss
echo -e "\n@import '~bulma/bulma'" >> src/assets/sass/main.scss
perl -i -0pe 's#^(Vue.config.productionTip.*$)#// Require the main Sass manifest file\nrequire\('"'"'./assets/sass/main.scss'"'"'\);\n\n\1#gms' /Users/dcvezzani/greenseedtechnologies/sudoku/src/main.js
perl -i -0pe 's#^( "dev": .*)$# "open": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --open",\n\1#gms' /Users/dcvezzani/greenseedtechnologies/sudoku/package.json
perl -i -0pe 's#(path: ./)(.,)#\1hello\2#g; s#^( routes: .*)$#\1\n {\n path: "/",\n name: "Sudoku",\n component: Sudoku\n },#gm; s#^(import HelloWorld.*)$#\1\nimport Sudoku from "@/components/Sudoku"#gm' /Users/dcvezzani/greenseedtechnologies/sudoku/src/router/index.js
sed -i'' -e '/logo.png/d' /Users/dcvezzani/greenseedtechnologies/sudoku/src/App.vue
@dcvezzani
dcvezzani / _overview.md
Created June 9, 2017 15:46
Generate state diagrams using Graphviz and JSON summary

Requirements

Install Ruby 2.3.1

Install Graphviz

brew install graphviz

Install JQ (command line JSON parser)

@dcvezzani
dcvezzani / 20170603-Cordova-Running-an-ios-app-in-a-specifi.md
Last active September 14, 2017 04:28
Cordova: Running an ios app in a specific ios emulator

Cordova: Running an ios app in a specific ios emulator

You need two flags when specifying which target to emulate. Also, do not include the version number on the end.

Find out what emulator images are available. Again, take into account that the version number will not be included when specifying the target in the cordova call.

./platforms/ios/cordova/lib/list-emulator-images

iPhone-5, 10.3

Scanner Driver Issue On Mac

For some reason, my Neat scanner is not working properly, specifically the driver doesn't seem to be starting up properly. I probably need to reboot my computer and it will be good. But in the mean time...

Open /Library/Image Capture/Devices

pasted_image_10_4_16__3_38_pm

Shut down Firefox. Open terminal.

cd ~/Library/Application Support/Firefox/Profiles
open ~/Library/Application Support/Firefox/Profiles

Navigate to target profile.

E.g.,

287 (from 1/9 to 1/12, inclusive)
[12874873, 12875363, 12875843, 12876413, 12877653, 12878263, 12878323, 12879033, 12879303, 12879763]..........DONE
[12880183, 12880273, 12880543, 12880703, 12880783, 12881003, 12881013, 12881323, 12881483, 12882323]..........DONE
[12882643, 12883043, 12883153, 12883783, 12885703, 12886703, 12887753, 12887853, 12888333, 12888593]..........DONE
[12888763, 12889303, 12889503, 12889843, 12890143, 12890253, 12890413, 12890583, 12890593, 12890793]..........DONE
[12891013, 12891583, 12892413, 12892763, 12892853, 12892873, 12893093, 12893183, 12893993, 12894123]..........DONE
[12894363, 12894423, 12894593, 12894983, 12895043, 12895083, 12895153, 12895263, 12895363, 12895713]..........DONE
[12896073, 12896123, 12896193, 12896683, 12896943, 12896953, 12897183, 12898203, 12898853, 12899483]..........DONE
[12899733, 12900423, 12901293, 12901343, 12901813, 12902463, 12902943, 12903373, 12903383, 12903733]..........DONE
@dcvezzani
dcvezzani / multi_io.rb
Created October 27, 2015 20:39
Writes to both STDOUT and the specified file; can include as many IO streams as you want
# Usage example:
#
# log_filename = File.join(log_path, "#{Sinatra::Base.environment.to_s}.log")
# $log_file = File.open(log_filename, 'a+')
#
# STDOUT.sync = true if 'yes' == ENV['API_DEBUG']
# $log_file.sync = true if 'yes' == ENV['API_DEBUG']
#
# require 'logger'
# $logger = Logger.new MultiIO.new(STDOUT, $log_file)
@dcvezzani
dcvezzani / gist:4e210993c2a0b620cdec
Created April 16, 2015 22:41
move files to a new location; leave redirect behind
base_dst_path="/Volumes/Extra/dave/downloads"
for file in \
BW-1161.exe milkallergy-companion-and-cookbook.pdf iPhoneConfigUtility.dmg Screenhero.zip iPhotoLibraryUpgrader.dmg join.me.zip
do
#mv $file $base_dst_path
ln -s $base_dst_path/$file
#echo -e "# file was moved on "$(date +"%Y-%m-%d %H:%M:%S")"\nopen \"$base_dst_path/$file\"" > $file.txt
done
@dcvezzani
dcvezzani / journal-quick-format-git-mappings
Last active December 19, 2015 07:59
Clean up my quick text file journal entries into html I can slap into my blog. Put this in your ~/.vimrc file or create a vim script file that can be included in ~/.vimrc.
" ************* basic conversion script ******************
" the '/e' regexp flag in vim allows subsequent regexp to be
" run even if the current regexp doesn't have any hits
function! JournalBasicConversion(...)
" isolate each code block and surround with <pre...
:%s/^}}/ç/g
:%s/\n{{\(\([\r\n]\+[^ç]\+.*\)\+\)\nç/\r<pre class=\"code\">\1\r<\/pre>/eg
" create titles
:%s/^==\+ \(.\+\)$/<h4>\1<\/h4>/eg