Skip to content

Instantly share code, notes, and snippets.

@juchong
juchong / zebra_lp2844.ppd
Created September 12, 2023 23:33
Zebra LP2844 CUPS-Compatible PPD
*PPD-Adobe: "4.3"
*% PPD file for EPL2 Label Printer with CUPS.
*% Created by the CUPS PPD Compiler CUPS v1.4b1.
*% Copyright 2007 by Apple Inc.
*% Copyright 1997-2007 by Easy Software Products.
*%
*% These coded instructions, statements, and computer programs are the
*% property of Apple Inc. and are protected by Federal copyright
*% law. Distribution and use rights are outlined in the file "LICENSE.txt"
*% which should have been included with this file. If this file is
@juchong
juchong / ha-control-fan.yaml
Created April 14, 2023 05:34 — forked from danijelst/ha-control-fan.yaml
Home-Assistant Blueprint to control fan speed based on temperature difference
blueprint:
name: Control fan speed based on remote temperature sensor
description: 'Set
'
domain: automation
input:
temperature_sensor:
name: Temperature sensor
description: This sensor will be used as the source.
selector:
@juchong
juchong / 1_75mm_MK3S-EINSy10a-E3Dv6full.h
Created May 7, 2021 06:23
Prusa MK3S Motor Config for IGUS Bearings
#ifndef CONFIGURATION_PRUSA_H
#define CONFIGURATION_PRUSA_H
#include <limits.h>
#include "printers.h"
/*------------------------------------
GENERAL SETTINGS
*------------------------------------*/
// Printer revision
@juchong
juchong / adcmxl_crc16_bytewise.c
Last active December 29, 2021 08:04
ADcmXL3021 CRC-16 Bytewise Example
/* ADcmXL3021 CRC-16 Bytewise example */
/* Juan Chong - 01/12/2021 */
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
/* Test data. NOTE: Data count, preamble, temp, status, and crc are NOT part of the crc calculation! */
uint8_t snsr_byte_1 [192] = {
/*0x05, 0xad,*/ 0x83, 0x84, //X Data
@juchong
juchong / adcmxl_crc16.c
Last active January 13, 2021 03:24
ADcmXL3021 CRC-16 Word (16-bit) Computation Example
// ADcmXL3021 CRC-16 Word Computation Example
// Juan Chong - 01/12/2021
#include <stdio.h>
#include <stdint.h>
uint16_t snsr_data_1 [96] = {
0x810B,0x8108,0x8109,0x810A,0x810B,0x810A,0x810C,0x810C, //X Data
0x810A,0x810A,0x8111,0x810B,0x810F,0x810F,0x810C,0x810E,
0x8109,0x810B,0x810A,0x810A,0x810A,0x810A,0x810A,0x810B,
@juchong
juchong / .gitignore
Created December 25, 2020 08:10
.gitignore that ignored all files within a repository except for specific files nested deep in subdirectories
#Ignore everything
/*
#Except top-level stuff
!/.gitignore
!/README.md
!/docker-compose.yml
#Except the nginx config file
#Every level in the directory structure must be exempted, re-ignored, and re-exempted with an extra level
@juchong
juchong / moveCompleted.sh
Last active July 3, 2023 19:59
This Deluge script makes a backup of the completed torrent download and checks for archives. If it finds them, it recursively extracts them, and removes the archive files in the process. Once complete, it moves the backup files back into the original directory and waits 2 hours to allow the *arr application to process the downloads. Finally, it …
#!/bin/bash
torrentid="$1"
torrentname="$2"
torrentpath="$3"
torrentdest="/seed/"
torrentlog="/config/script_logs/torrentCompleted.log"
echo "==== Start Processing Torrent ====" >> $torrentlog
@juchong
juchong / imu_buffer.py
Last active August 9, 2020 02:22
IMU Buffer Example
# %%
import spidev
from time import sleep
class ImuSpiDriver:
def __init__(self, bus, device):
self.spi = spidev.SpiDev()
self.spi.open(bus, device)
self.spi.max_speed_hz = 4000000
self.spi.mode = 3