Skip to content

Instantly share code, notes, and snippets.

@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 June 11, 2024 11:48
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 February 10, 2024 09:16
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
@VinceG
VinceG / Builder.php
Created October 19, 2016 14:16
Laravel support for replace into / insert ignore / insert on duplicate key update
<?php
namespace App\Library\Database\Query;
use Illuminate\Database\Query\Builder as QueryBuilder;
class Builder extends QueryBuilder
{
/**
* Insert a new record into the database.
@lg
lg / angry_wifi.sh
Last active November 28, 2023 23:56
auto disconnects clients with a low signal strength on LEDE / OpenWRT
#!/bin/ash
#
# angry_wifi.sh
#
# auto disconnects clients with a low signal strength on LEDE / OpenWRT. great
# for clients who hold onto a lower-signal-strength accesspoint instead of
# roaming. before running, make sure to download the latest MAC addresses with:
#
# wget --no-check-certificate -O - 'https://services13.ieee.org/RST/standards-ra-web/rest/assignments/download/?registry=MAC&text=apple' | cut -d, -f2 > apple_mac_addresses
#