Skip to content

Instantly share code, notes, and snippets.

@BigNerd95
BigNerd95 / glddnsupdater.sh
Last active February 18, 2025 18:20
GL.iNet ddns update script [will associate your wan IP to puXXXXX.gl-inet.com where XXXXX are the latest 5 bytes of the mac address]
#!/bin/sh
# OpenWRT support libs
. /lib/functions.sh
. /lib/functions/network.sh
. /usr/share/libubox/jshn.sh
ip_regex="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
ddns=
code=
@emmanueltissera
emmanueltissera / git-apply-patch.md
Created September 13, 2017 02:34
Generate a git patch for a specific commit

Creating the patch

git format-patch -1 <sha>
OR
git format-patch -1 HEAD

Applying the patch

git apply --stat file.patch # show stats.
git apply --check file.patch # check for error before applying

@judgej
judgej / setphp
Last active January 24, 2020 17:28
bash script to switch between PHP versions in Plesk
#!/bin/bash
# Use the script like this:
# . setphp 7.1
# or
# source setphp 5.6
#
# It will look for the path to the current PHP version in your PATH and switch to
# the new PHP version.
# If you do not have a path to a php version, then it will add one.
@javierarques
javierarques / jsdom-helper.js
Last active January 12, 2022 00:51
Simulate window resize event in jsdom
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const dom = new JSDOM('<!DOCTYPE html><html><head></head><body></body></html>');
global.window = dom.window;
global.document = dom.window.document;
// Simulate window resize event
const resizeEvent = document.createEvent('Event');
@braian87b
braian87b / dumb-ap-wired-link.sh
Last active May 4, 2025 20:09
How to setup a Dumb AP, Wired backbone for OpenWRT / LEDE
@structure7
structure7 / mailboxWatcher.ino
Last active November 18, 2020 11:09
Blynk mailbox sensor (mosfet + reed switch + WeMos)
#include <SimpleTimer.h>
//#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <BlynkSimpleEsp8266.h>
extern "C" {
uint16 readvdd33(void);
}
char auth[] = "fromBlynkApp";
const char* ssid = "ssid";
@rushipkar90
rushipkar90 / qmail commands
Created March 30, 2017 04:05
qmail commands
How To Manage QMail Queue In Linux Plesk
Ref URL
----------------
http://geeksterminal.com/qmail-commands-logs-plesk-server/580/
https://www.24x7servermanagement.com/blog/how-to-manage-qmail-queue-in-linux-plesk/
----------------
1) To check the mail queue in plesk from command line, you can use the command :
@jwalanta
jwalanta / OpenWrt detect new device and send text message.md
Last active April 21, 2025 08:59
Detect new network devices connecting to OpenWrt and send text message
@is-just-me
is-just-me / test_functions.php
Last active November 15, 2022 07:36
Create combinations,products and update stock with Prestashop WEBSERVICE
<?php
function add_combination($data){
global $webService, $config;
try{
$xml = $webService->get(array('url' => $config["ps_shop"].'api/combinations?schema=blank'));
$combination = $xml->children()->children();
$combination->associations->product_option_values->product_option_values[0]->id = $data["option_id"];
$combination->reference = $data["code"];
$combination->id_product = $data["id_product"];
@NunoFilipeSantos
NunoFilipeSantos / DisableRootAccessSSH.sh
Last active May 5, 2018 10:00
Disable root access via SSH
#!/bin/bash
# Disable root access via SSH
# USAGE:
# curl -Lo DisableRootAccessSSH https://gist.githubusercontent.com/NunoFilipeSantos/7eee84fcb40b52d5ede6332f902d1b1c/raw/DisableRootAccessSSH.sh
# chmod +x DisableRootAccessSSH
# ./DisableRootAccessSSH
perl -pi -e 's/PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config