This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
NewerOlder