This file contains hidden or 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 | |
| # Kill SSH sessions that have been idle longer than IDLE_LIMIT minutes | |
| # Usage: ./killIdle.sh | |
| # DRY_RUN=1 ./killIdle.sh (report only, kill nothing) | |
| # Set the idle time limit (in minutes) to consider the session as hung | |
| IDLE_LIMIT=${IDLE_LIMIT:-3000} | |
| # Set DRY_RUN=1 to only report sessions that would be killed | |
| DRY_RUN=${DRY_RUN:-0} |
This file contains hidden or 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
| import sys | |
| import termios | |
| import tty | |
| from evdev import InputDevice, list_devices, categorize, ecodes | |
| from select import select | |
| # Key constants | |
| KEY_UP = "UP" | |
| KEY_DOWN = "DOWN" | |
| KEY_LEFT = "LEFT" |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| import subprocess, time, fcntl, sys | |
| from RPLCD.i2c import CharLCD | |
| from ir.ui import read_key, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_ENTER, KEY_BACKSPACE, KEY_QUIT | |
| LCD_I2C_ADDR = 0x27 | |
| LOCK_FILE = "/tmp/lcd.lock" | |
| lcd = CharLCD(i2c_expander="PCF8574", address=LCD_I2C_ADDR, cols=16, rows=2, charmap="A00", auto_linebreaks=False) | |
This file contains hidden or 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
| import time | |
| import netifaces | |
| from RPLCD.i2c import CharLCD | |
| import fcntl | |
| # --- Configuration --- | |
| WIFI_IFACE = "wlan0" | |
| LCD_I2C_ADDR = 0x27 | |
| LOCK_FILE = "/tmp/lcd.lock" |
This file contains hidden or 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
| import RPi.GPIO as GPIO | |
| import time | |
| import random | |
| # Setup GPIO | |
| GPIO.setmode(GPIO.BCM) | |
| GPIO.setup(17, GPIO.OUT) | |
| pwm = GPIO.PWM(17, 1000) # 1kHz PWM frequency | |
| pwm.start(100) |
This file contains hidden or 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
| #light-switch { | |
| position: fixed; | |
| top: -1.5em; | |
| right: 1em; | |
| text-align: center; | |
| cursor: pointer; | |
| z-index: 1021; | |
| } | |
| #light-switch div.rounded-circle { |
This file contains hidden or 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 | |
| # Monitor file for changes and send email and/or PagerDuty notification | |
| # Usage: ./logmond.sh [-e recipient@domain.com] [-p] /path/to/file | |
| # | |
| # -e email new lines to recipient (requires s-nail) | |
| # -p trigger a PagerDuty incident with new lines (requires pd-send) | |
| # | |
| # PagerDuty key is read from PAGERDUTY_INTEGRATION_KEY, or loaded from | |
| # ~/.config/logmond/logmond.env (chmod 600) if not already set. | |
| # Override the config path with LOGMOND_CONFIG. |
This file contains hidden or 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
| <?php | |
| $sku = 'PBSEXP50'; | |
| $url = 'https://www.fitnessdepot.ca/WebService/store-inventory.php?store_id=6&price=549.88&sku=' . $sku; | |
| // List of nodes I don't want to check, some store inventory is not up to date | |
| $ignoreNodes = [ | |
| 'Oakville', | |
| 'Call or Email to Order1-877-776-8547ecommerce@fitnessdepot.ca' | |
| ]; | |
| $foundNodes = []; |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <string.h> | |
| #include <regex.h> | |
| #define TEST_REGEX "^.*\\/([a-zA-Z_.]*)\\.log : [A-Z]{3} [0-9]{2}\\/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{6} .* : (.*)$" | |
| #define MAX_REGEX_MATCHES 5 | |
| #define MAX_STRING_SIZE 1000 | |
| #define MAX_ERR_LENGTH 50 | |
| /** |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "path/filepath" | |
| "regexp" | |
| ) | |
| func main() { |
NewerOlder