Skip to content

Instantly share code, notes, and snippets.

View mattConn's full-sized avatar
👾
UX engineer @ Harbour

Matt mattConn

👾
UX engineer @ Harbour
View GitHub Profile
@mattConn
mattConn / timeline.css
Last active January 7, 2023 23:28
Vertical timeline component. Example: https://mattconn.github.io/timeline/
/* timeline event styles */
.timeline-event {
display: flex;
}
.timeline-event .timeline-event_copy {
padding: 0 1em;
}
.timeline-event .timeline-event_copy.current {
This file has been truncated, but you can view the full file.
Last login: Mon Aug 13 15:28:51 on ttys001
gMatthews-MBP:mathematics-programming matthew$ gd
Matthews-MBP:development matthew$ cd repo/mathematics-programming/
Matthews-MBP:mathematics-programming matthew$
@mattConn
mattConn / include_file_with_directive.sh
Created July 21, 2017 02:27
Uses sed to insert a file's contents at a specific string (directive), then remove the string (leaves behind a space).
sed -i '/##INSERT HERE/r file_to_insert.txt' file_inserted_to.txt
# now remove directive
sed -i 's/##INSERT HERE//g' file_inserted_to.txt
@mattConn
mattConn / ubuntu-server-setup.txt
Created June 28, 2017 20:36
Ubuntu server setup notes.
Basic ubuntu home server set up
For shell login greeting
/etc/issue.net
or change line “Banner” in /etc/ssh/sshd_config
BUT
This will display banner before authentication; may be best in bashrc
Enable SSH
@mattConn
mattConn / quick_git_commit_push.sh
Created June 6, 2017 18:59
Quick git "commit -m" and push script
read input;
git add .; git commit -m "$input"; git push;
@mattConn
mattConn / simple_loop.sh
Last active March 22, 2017 21:42
Simple shell script to repeatedly run a command every 2 seconds.
#!/bin/sh
read input;
while true; do clear; $input; sleep 2; clear; done;
@mattConn
mattConn / simple_watch_scripts.sh
Last active March 19, 2017 03:47
Simple watch scripts; one for Linux that uses inotifytools, one for Mac that uses fswatch. On file change, concat.sh is run and concatenates listed files.
# concat.sh
cat \
file1 \
file3 \
> file3
@mattConn
mattConn / loop_over_json_array_with_nodejs.js
Created March 13, 2017 06:19
Loop over an array in JSON file with Node. Hypothetical file here is "data.json", with an array named "array" located immediately within the object (not nested).
var fs = require('fs'),
util = require('util'),
exec = require('child_process').exec,
json = JSON.parse(fs.readFileSync('data.json'));
function puts(error, stdout, stderr){console.log(stdout, stderr)}
for (var i in json.array){
exec('echo '+json.array[i], puts);
}
@mattConn
mattConn / get_all_text_elements.js
Last active March 11, 2017 05:06
Get all text elements in a document.
// simple tag getting fn
var getTag = function(tag){
return document.getElementsByTagName(tag);
}
// wanted: elements we want to get by tag.
// caught: tags caught; where we will put the wanted elements, if they exist.
// missing: if tag not present in document, list here.
var textCatcher = {
wanted : ['p','ul','ol','li','a','span','strong','i','b','h1','h2','h3','h4','h5','h6'],
@mattConn
mattConn / format_multiline_exec.php
Created January 1, 2017 00:56
Preserve formatting when displaying exec's returned string.
<?php
exec("$command 2>&1 &", $output);
foreach ($output as $line) {
echo "$line\n";
}
?>