Skip to content

Instantly share code, notes, and snippets.

View nucleardreamer's full-sized avatar
🚀
obviously jammin'

Flynn Joffray nucleardreamer

🚀
obviously jammin'
View GitHub Profile
#!/bin/bash -e
find . -depth -not -path '*/\.*' | while read file ; do
directory=$(dirname "$file")
filename=$(basename "$file")
newfilename=$(echo "$filename" | sed 's/[^a-zA-Z0-9_. -]//g' | tr '[:upper:]' '[:lower:]')
if [ "$filename" != "$newfilename" ]; then
mv "$directory/$filename" "$directory/$newfilename"
fi
done
@nucleardreamer
nucleardreamer / latch.js
Created March 7, 2019 20:05
Southco EA-A06-01 USB Controller
const SerialPort = require('serialport')
const port = new SerialPort('/dev/ttyUSB0', {
baudRate: 38400,
dataBits: 8,
stopBits: 1,
parity: 'none'
})
const parseBufPayload = data => data.toString().replace(/[^a-zA-Z0-9]/gi, '')
@nucleardreamer
nucleardreamer / extruder1_end.gcode
Created January 3, 2019 20:53
MP Delta Mini Settings
M104 S0 ; turn off hotend heater
M140 S0 ; turn off bed heater
G91 ; Switch to use Relative Coordinates
G1 E-3 F700 ; retract the filament a bit before lifting the nozzle to release some of the pressure
G1 Z2 F1000 ; raise platform 2mm from current position
G1 E-2 F700 ; retract filament even more
G90 ; Switch back to using absolute coordinates
G28 X ; Return to home position. Without an X Y or Z after G28 the print completion time will not be displayed on the Mini Delta's display.
M84 ; disable motors
G4 S300 ; pause for 300 seconds to keep fan running to cool hotend and allow the fan to be turned off
const SerialPort = require('serialport')
const _ = require('lodash')
const async = require('async')
var devices = []
// find all lights and connect to them (serial port opens automatically)
function init (config, cb = function () {}) {
// example device
// comName: '/dev/ttyACM1',
// manufacturer: 'OAK',
@nucleardreamer
nucleardreamer / gist:4ec816c032db094f6cded91193db6caf
Created May 14, 2017 15:05
parse a stream of delimited lines
const _ = require('lodash')
const parseDelimitedLines = function (stream, delimiter, nl, callback) {
let buf = ''
let err = null
let output = []
let headers = []
stream.on('data', function (data) {
buf += data
@nucleardreamer
nucleardreamer / arch-linux-install
Created August 11, 2016 21:12 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
#!/bin/bash -e
SUDO=
if [ "$UID" != "0" ]; then
if [ -e /usr/bin/sudo -o -e /bin/sudo ]; then
SUDO=sudo
else
echo '*** run sudo bruh'
exit 0
fi
@nucleardreamer
nucleardreamer / gist:34ce41d2800836d35aee
Created December 25, 2015 00:38
short circuit isvalid function
var _ = require('lodash');
// Iterate through all supplied parameters and check if everyone of them is valid
// Checking is done from left to right and short-circuited. So you can supply parameters
// like obj, obj.key1, obj.key1.subkey1 and obj.key1 will be checked only if obj is valid.
var isValid = function(obj /* obj1, obj2, obj3... */){
var args = Array.prototype.slice.call(arguments);
for (var i=0; i < args.length; i++){
if (_.isUndefined(args[i]) || _.isNull(args[i]) || _.isNaN(args[i])) return false;
@nucleardreamer
nucleardreamer / iosbuild.sh
Created December 21, 2015 21:10 — forked from reqshark/iosbuild.sh
libmill iOS cross-compile for 32 bit (armv7) and 64 bit (arm64) iOS, and i386 and x86_64 simulators
# Copyright (c) 2015 Bent Cardan
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom
# the Software is furnished to do so, subject to the following conditions:
// this is just to install git
sudo apt-get install git
// get in there
cd /to/your/project/folder
// this sets up the git folder, which is located in that directory in .git, it keeps track of all your changes and settings
git init
// this adds all changed files to a changeset. nothing happens here except for that you are saying you want to track these changes. the period after add means everything in that directory