Skip to content

Instantly share code, notes, and snippets.

@ianchen06
ianchen06 / useful.sh
Created August 3, 2017 09:44
useful linux commands
#!/bin/sh
# replace words in file recursively
grep -r 'hello' -l --null . | xargs -0 sed -i 's#hello#world#g'
@ianchen06
ianchen06 / del_cluster.sh
Created June 26, 2017 10:29
delete proxmox cluster
# source: https://forum.proxmox.com/threads/removing-deleting-a-created-cluster.18887/
#/bin/sh
# stop service
systemctl stop pvestatd.service
systemctl stop pvedaemon.service
systemctl stop pve-cluster.service
systemctl stop corosync
systemctl stop pve-cluster
# edit through sqlite, check, delete, verify
@ianchen06
ianchen06 / Configuration.h
Created June 24, 2017 11:39
Marlin Skynet3D
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ianchen06
ianchen06 / bootstrap.sh
Created June 22, 2017 16:44
macOS bootstrap scripts
#!/bin/bash
set -ex
echo "Installing HomeBrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "Installing wget"
brew install wget zsh openssl readline xz
echo "Installing oh my zsh"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
@ianchen06
ianchen06 / end.gcode
Last active February 23, 2022 01:38
Anet A8 start end gcode
;End GCode
M104 S0 ;extruder heater off
M140 S0 ;heated bed heater off (if you have it)
G91 ;relative positioning
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
M84 ;steppers off
#!/bin/bash
JQPATH=$(which jq)
if [ "x$JQPATH" == "x" ]; then
echo "Couldn't find jq executable." 1>&2
exit 2
fi
set -eu
shopt -s nullglob
# Copied from http://ttaportal.org/wp-content/uploads/2012/10/7-Reallocation-using-LVM.pdf
##
## Showing the problem: need to reallocate 32GB from /dev/mapper/pve-data to /dev/mapper/pve-root
##
df -h
# Filesystem Size Used Avail Use% Mounted on
# /dev/mapper/pve-root 37G 37G 0 100% /
# tmpfs 2.0G 0 2.0G 0% /lib/init/rw
@ianchen06
ianchen06 / serial_cu.sh
Created May 5, 2017 08:13
use cu instead of screen for serial communication...
#!/bin/sh
# https://bbs.nextthing.co/t/garbage-text-on-screen-dev-tty-usbmodem1411/2582/3
sudo cu -l /dev/tty.usbmodem2411 -s 115200
@ianchen06
ianchen06 / convert.sh
Last active February 10, 2025 16:19
proxmox convert LVM raw to qcow2 for migration
#!/bin/sh
pvesm path vm_data1:vm-115-base-disk
qemu-img convert -O qcow2 /dev/vm_data1/vm-115-base-disk /root/ps.qcow2
@ianchen06
ianchen06 / kube-change-schedule.sh
Created May 4, 2017 10:37
change kubernetes node schedulability
kubectl patch node ${MASTER_NAME} -p "{\"spec\":{\"unschedulable\":true}}"