Skip to content

Instantly share code, notes, and snippets.

View Matts966's full-sized avatar
:octocat:
Coding

Matts966 Matts966

:octocat:
Coding
View GitHub Profile
@Matts966
Matts966 / copy_tabs.bash
Last active November 1, 2019 15:52
Copy all tabs of some applications to others
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "please pass me 2 application names"
echo "e.g. './copy_tabs.bash Safari Google\ Chrome'"
exit 1
fi
from_browser=$1
to_browser=$2
osascript <<EOF | while read line; do open -a "$to_browser" $line; done
set urls to ""
@Matts966
Matts966 / open_cloud_tabs.bash
Last active June 3, 2023 23:01
Open all tabs in cloud tabs using sqlite3 on mac
#!/bin/bash
if [ "$#" == 0 ]; then
browser=Google\ Chrome
elif [ "$#" == 1 ]; then
browser=$1
else
echo "please pass me a browser name or run with no argument (default browser is 'Google\ Chrome')"
echo "e.g. './open_cloud_tabs.bash Safari'"
exit 1
fi
@Matts966
Matts966 / multi-asm.ino
Last active December 21, 2019 09:05
Write multiple line assembly in Arduino
// single line example
#define ASM(x) asm volatile(x "\n\t")
void setup() {
ASM("ldi r16, 0b00001000");
ASM("out 0x17, r16");
ASM("ldi r19, 1");
ASM("ldi r20, 1");
task();
}
@Matts966
Matts966 / random-led
Last active December 21, 2019 09:54
ATTiny 85 random blink
void setup() {
asm volatile(R"(
ldi r16, 0b00001000
out 0x17, r16
ldi r19, 1
ldi r20, 1
task1:
ldi r16, 0b00001000
out 0x18, r16
rcall delay0
@Matts966
Matts966 / fibonacci_led.ino
Last active December 21, 2019 09:54
Fibonacci led
void setup() {
asm volatile(R"(
ldi r16, 0b00001000
out 0x17, r16
ldi r19, 0
ldi r20, 1
ldi r21, 1
task1:
ldi r16, 0b00001000
out 0x18, r16
@Matts966
Matts966 / ris_to_list.py
Created January 19, 2020 08:10
.ris file to citation list
from sys import stdin
index = 0
finding_author = False
author = ""
finding_publish_year = False
publish_year = ""
etal = False
for line in stdin:
if line.startswith("TI"):
index += 1
@Matts966
Matts966 / haskell-ide-engine-for-ghc-8.0.2.yaml
Last active February 3, 2020 03:04
Install hie for ghc-8.0.2.
resolver: lts-9.12
packages:
- .
- hie-plugin-api
extra-deps:
- apply-refact-0.3.0.1
- brittany-0.11.0.0
- butcher-1.3.1.1
- constrained-dynamic-0.1.0.0
@Matts966
Matts966 / Brewfile
Created April 29, 2020 12:08
My Brewfile
tap "adoptopenjdk/openjdk"
tap "crisidev/chunkwm"
tap "d12frosted/emacs-plus"
tap "github/gh"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
tap "homebrew/php"
tap "homebrew/science"
tap "homebrew/services"
docker run -it --rm -v `pwd`:/home:Z matts966/zetasql-formatter:latest paths/to/sql/files
FROM l.gcr.io/google/bazel:1.0.0 as builder
# Use gcc because clang can't build m4
RUN apt-get update && \
apt-get install build-essential software-properties-common -y && \
add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
apt-get update && \
# Use gcc-9 for using std::filesystem api
apt-get install --no-install-recommends -y make gcc-9 g++-9 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 \