Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonah Dahlquist jonahbron

View GitHub Profile
@jonahbron
jonahbron / install.sh
Last active Oct 31, 2020
Install AVR Rust and Compile Blink
View install.sh
git clone git@github.com:avr-rust/rust.git avr-rust
cd avr-rust
git checkout avr-support # 8405b30 at time of writing
cp config.toml.example config.toml
# Manually uncomment experimental-targets setting in config.toml
./x.py build
rustup toolchain link avr $(realpath $(find build -name 'stage2'))
cd ../../
@jonahbron
jonahbron / error
Created Apr 6, 2020
could not compile core
View error
$ cargo +avr xbuild --target avr-unknown-unknown --verbose
WARNING: There is no root package to read the cargo-xbuild config from.
+ "rustc" "--print" "sysroot"
+ "rustc" "--print" "target-list"
+ "/home/jonah/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "rustc" "-p" "alloc" "--release" "--manifest-path" "/tmp/xargo.enQPopALFvIP/Cargo.toml" "--target" "avr-unknown-unknown" "-v" "--" "-Z" "force-unstable-if-unmarked"
Updating crates.io index
Downloaded compiler_builtins v0.1.26
Downloaded 1 crate (134.9 KB) in 0.78s
Compiling core v0.0.0 (/run/media/jonah/data/Projects/avr-rust/src/libcore)
Compiling compiler_builtins v0.1.26
View keybase.md

Keybase proof

I hereby claim:

  • I am jonahbron on github.
  • I am jonahbron (https://keybase.io/jonahbron) on keybase.
  • I have a public key ASAQcovf4Sc4CtkLdfWGLClTsfsATzTThCgJseBdcfsQHQo

To claim this, I am signing this object:

View FirebaseListAdapter.java
import android.app.Activity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
View watch_web_page.sh
#!/bin/bash
URL="page to watch"
PATTERN="pattern in page to watch"
get_page() {
curl "$URL" 2> /dev/null | grep -C 3 "$PATTERN"
}
NEW=$(get_page)
View example.html
<md-input-container>
<label>Select Menu</label>
<md-select aria-label="Select menu" ng-model="vm.model">
<md-option ng-value="item" ng-repeat="item in vm.options track by item.id" ng-bind="item.name" select-track-by="id" select-model="vm.model"></md-option>
</md-select>
</md-input-container>
@jonahbron
jonahbron / serve
Created Jul 15, 2014
Single file server
View serve
serve_file=$1
ip_addr=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
echo "$ip_addr:8000"
while true ; do nc -l 8000 < "$serve_file" ; done
View untrusted-lvl12-solution.js
/*
* robotNav.js
*
* The green key is located in a slightly more
* complicated room. You'll need to get the robot
* past these obstacles.
*/
function startLevel(map) {
// Hint: you can press R or 5 to "rest" and not move the
@jonahbron
jonahbron / rrgrep.sh
Created Jan 30, 2014
Shorten the command to search through rake routes
View rrgrep.sh
# Create a new, empty file if it does not exist. Creates parent directories if necessary.
#
# author Jonah Dahlquist
# license CC0
rrgrep() {
if hash zeus 2>/dev/null; then
zeus rake routes | grep $@
else
rake routes | grep $@
@jonahbron
jonahbron / punch.sh
Created Dec 18, 2013
Create a new, empty file if it does not exist. Creates parent directories if necessary.
View punch.sh
# Create a new, empty file if it does not exist. Creates parent directories if necessary.
#
# author Jonah Dahlquist
# license CC0
punch() {
mkdir -p $(dirname $1)
touch $1
}