Skip to content

Instantly share code, notes, and snippets.

@lachesis
lachesis / weather-discussion.py
Created May 18, 2022 21:11
NWS weather textual discussion
#!/usr/bin/python
import argparse
import re
import sys
import requests
def main():
SHOW_GROUPS = [
r'SYNOPSIS',
r'DISCUSSION',
@3hedgehogs
3hedgehogs / ansible-runner-with-module.py
Created May 17, 2022 16:10
Runn ansible module from python script and print cache
#!/usr/bin/env python
import io
import os
import json
import sys
import ansible_runner
def finished_callback(runner):
@Dominicus1165
Dominicus1165 / Install_Script.ps1
Last active February 28, 2024 09:30
Winget install script for Windows
<#
# 0. Windows 10 only: update "App Installer" on Windows Store
#
# 1. Win+X => A
# 2. cd C:\Users\xxx\Desktop or C:\Users\xxx\OneDrive\Desktop if you have OneDrive
# 3. Set-ExecutionPolicy Unrestricted
# 4. .\Install_Script.ps1
#>
<#
@AndrewToaster
AndrewToaster / termansi.py
Last active April 15, 2023 18:39
Python file containing ANSI VT functionality
from typing import Final, Any
class Terminal:
"""Contains functions for making ANSI CSI escape values relating to the terminal window"""
@staticmethod
def move_up(amount: int = 1):
"""Creates an ANSI CSI value for moving the cursor up
:param int amount: The amount to move the cursor (default 1)
@gh640
gh640 / func_name.sh
Created May 14, 2022 04:12
Zsh / Bash: Getting the current function name invoked
function func_name {
case "${SHELL}" in
*/bash)
# Bash
echo ${FUNCNAME[2]}
;;
*/zsh)
# Zsh
echo ${funcstack[2]}
;;
@JenieX
JenieX / pretending-tab-images-viewer.user.js
Created May 12, 2022 04:18
A simple User Script that opens the full size image in tab like view
// ==UserScript==
// @name Pretending Tab - Images Viewer
// @namespace https://github.com/FlowerForWar/Pretending-Tab-Images-Viewer
// @description Opens the full size image in tab like view. Offering three view states. Fitting, filling, original.
// @version 0.14
// @author FlowrForWar
// @include *
// @grant GM_xmlhttpRequest
// @grant GM.xmlHttpRequest
// @grant GM_setClipboard
@gtirloni
gtirloni / ansible_version.md
Last active July 28, 2022 00:01
ansible_version.py

ansible_version.py

This is a plugin that verifies if the Ansible version meets the version requirements.

You can use the same range identifiers from Ansible Galaxy, separate by commas:

*: The most recent version. This is the default.
!=: Not equal to the version specified.
==: Exactly the version specified.
@cmbuckley
cmbuckley / 617179.php
Last active September 29, 2022 00:39
<?php
$headers = [
"Content-Security-Policy: style-src 'self'",
"Content-Type: application/json",
];
foreach ($headers as $header) {
header($header);
}
@downthecrop
downthecrop / AbstractSprite.java
Last active January 11, 2024 21:56
Abstract Sprite dumper Runescape 530 Cache
package org.runite.client;
import org.rs09.client.Node;
import org.rs09.client.rendering.Toolkit;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
@diffficult
diffficult / watchdog_setup.md
Created May 4, 2022 21:12
Setting up "Watchdog" to keep Raspberry Pi Alive

We have deployed a couple of long-running Raspberry Pis equipped with cameras and sensors reporting into our network 24/7. All these are under uptime monitoring for us to keep track of the network availability.

From to time one of our Raspberry Pis freezes in the field either because of a kernel or a hardware issue. In that case there is nothing that can be done with software anymore. You can’t connect to it, can’t ping the Pi – It becomes impossible to send it a restart command in any way to bring it back to normal operation. Debugging into these events you might find indications of such as freeze in the /var/log/kernel.log file, and only manual powering down, and powering up again brought it back to live.

One little known Pi features is a builtin hardware watchdog. This little hardware service will once enabled watch the system activity and automatically power cycle the Raspberry Pi once it gets stuck.

It’s done in few steps directly on a terminal on your Pi:

  1. Enable the hardware watchdog on your Pi a