Skip to content

Instantly share code, notes, and snippets.

View infusion's full-sized avatar

Robert Eisele infusion

View GitHub Profile
@infusion
infusion / drawAtLineIntersection.m
Last active October 8, 2016 22:28
Matlab Drawing Helper
% Draws a point at the intersection of two lines
% L1 = V1 + s * W1
% L2 = V2 + t * W2
function drawAtLineIntersection(V1, W1, V2, W2)
if isequal(V1, V2) && isequal(W1, W2)
c = V1; % could be any point on the line
else
i = [W1, -W2] \ (V2 - V1);
@infusion
infusion / import-tar-gz.sh
Last active May 4, 2023 06:00
Import a tar.gz file to MySQL
tar xOf dump.sql.tar.gz | mysql -u $user -p $database
@infusion
infusion / simulate-clicks.c
Last active June 21, 2016 11:22
Simulate clicks on OSX with C
// gcc -o click click.c -Wall -framework ApplicationServices
#include <ApplicationServices/ApplicationServices.h>
#include <unistd.h>
// Coord to click on
#define X 422
#define Y 192
int main() {
@infusion
infusion / url2pdf.sh
Created August 18, 2015 16:53
Download a website as PDF
#!/bin/bash
function url2pdf {
tmp_file=.tmp.html
res_file=${1//[^A-Za-z0-9.:-]/}.pdf
curl $1 > $tmp_file
cupsfilter -f $tmp_file > $res_file
rm $tmp_file
@infusion
infusion / fork-and-write-pid.sh
Created August 16, 2015 01:45
Fork a command and write the pid file on Bash
((/usr/local/php/bin/php -f /var/www/queue.php) & echo $! > /var/run/queue.pid &)
@infusion
infusion / copy-pubkey.sh
Last active August 29, 2015 14:27
Copy the pubkey to the clipboard
cat ~/.ssh/id_rsa.pub | pbcopy
pandoc --mathjax --from markdown --to html5 -s file.md -o file.html
git branch -d branchname
git push origin :branchname
git push origin :v1.0.0
git tag -d v1.0.0
git reset --soft "HEAD~1"
git push -f origin HEAD^:master