Skip to content

Instantly share code, notes, and snippets.

View karlbaillie's full-sized avatar
:octocat:

Karl Baillie karlbaillie

:octocat:
View GitHub Profile
@karlbaillie
karlbaillie / start.gcode
Created February 22, 2022 10:37
Ender 3 Cura Start/Stop G-Code with ABL
; Ender 3 Custom Start G-code
M117 Getting the bed up to temp!
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
M117 Pre-heating the extruder!
M104 S160; start warming extruder to 160
G28 ; Home all axes
M117 Auto bed-level GO!
G29 ; Auto bed-level (BL-Touch)
G92 E0 ; Reset Extruder
@karlbaillie
karlbaillie / install-rbenv.sh
Last active March 3, 2022 22:44
Install rbenv on Ubuntu 20.04
cd ~
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
rbenv init
sudo apt-get install -y libssl-dev zlib1g-dev
rbenv install 2.7.1
rbenv global 2.7.1
@karlbaillie
karlbaillie / docker-compose.yml
Last active October 7, 2022 15:18
Self-Hosted Stack w/Traeik Front End
version: "2.4"
networks:
frontend:
external: true
backend:
external: true
vlan30:
driver: macvlan
driver_opts:

Keybase proof

I hereby claim:

  • I am kjbweb on github.
  • I am kjbweb (https://keybase.io/kjbweb) on keybase.
  • I have a public key ASAhNuXWVw0MzXkk1X-bYIguHNa1HIfTDlMXUdsp6qoa1Qo

To claim this, I am signing this object:

@karlbaillie
karlbaillie / reindex.sh
Created April 3, 2019 11:02
Reindex ElasticSearch one index at a time using ElasticDump.
#!/bin/bash
# REQUIRES:
# elasticdump, gzip, curl
# BE CAREFUL OF:
# the check before it'll delete the index it's just dumped it to just see if it's
# larger than a gzip file with no content (21 bytes), more thorough checking may be required depending
# on importance and availability of your data
@karlbaillie
karlbaillie / running-on-boot.sh
Created February 18, 2019 09:12
Ensure All Currently Running Services Start on Boot (CentOS7 / SystemD)
for i in $(systemctl list-units --type=service --state=running | tail -n +2 | grep ".service" | awk '{print $1}'); do systemctl enable $i; done
@karlbaillie
karlbaillie / config.cfg
Last active March 6, 2020 11:11
Monitor a Directory and SFTP Files to Multiple Destinations
## CONFIGURATION
export NAME=$(basename "$0" .sh)
export LOCKFILE_DIR="Lockfile"
export PENDING_DIR="Inbound"
export FAILED_DIR="Failed"
export PROCESSED_DIR="Processed"
export LOG_FILE="$NAME.log"
export NOTIFY_ON_FAIL=true
export NOTIFY_EMAIL="mail@karlbaillie.com"
export DEBUG=true
@karlbaillie
karlbaillie / get-interface-by-ip.rb
Created January 2, 2018 16:02
Get Network Interface by IP with Ruby
#!/home/kbaillie/.rbenv/shims/ruby
node_ip = "192.168.1.1"
require 'socket'
addr_infos = Socket.getifaddrs
addr_infos.each do |addr_info|
next unless addr_info.addr.ipv4?
if node_ip == addr_info.addr.ip_address
puts "#{addr_info.name}"
@karlbaillie
karlbaillie / generate-test-files.sh
Created January 2, 2018 16:00
Test File Generator
#!/bin/bash
#
# A script to generate any number of files with random names and contents
#
# Usage: generate-test-files.sh (No. of Files) (Size in MB) (Path To Destination)
# Example: ./generate-test-files.sh 50 25 ./Folder
#
# (c) 2017, Karl Baillie <mail@karlbaillie.com>
#
@karlbaillie
karlbaillie / tidy.sh
Created November 30, 2017 11:45
Delete files if the mount they live on is getting full
#!/bin/bash
# find out how much space is available on the partition /var/log/app resides upon
SPACE_USED=$(df -P /var/log/app | awk '{ if(NR>1)print }' | awk '{ print $5 }' | tr -d '%')
# set the threshold to clear at once breached (percentage)
SPACE_USED_MAX=80
# get the date in a format we can use
DATE=$(date '+%Y%m%d')
# if we're getting low on space where /var/log/app resides