Skip to content

Instantly share code, notes, and snippets.

@pemitic
pemitic / MySQL Slugify Stored Function.sql
Last active November 14, 2024 10:42
MySQL Slugify Stored Function
-- mysql -h HOST -u USER -p DB_NAME < slugify_function.sql
-- SELECT SLUGIFY(table1.title) FROM table1
DROP FUNCTION IF EXISTS `SLUGIFY`;
DELIMITER ;;
CREATE FUNCTION `SLUGIFY`(dirty_string VARCHAR(255))
RETURNS VARCHAR(255)
DETERMINISTIC
BEGIN
@pemitic
pemitic / Canon_report.py
Created August 1, 2024 06:23
Canon Printers Counters Report
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#Get SNMP Value for canon printers for total page count using PySNMP, export to pdf, then email to required user#
#Need to install pysnmp, reportlab and smtplib using pip or easy install#
#Those are the OIDS for counters and serial
#TOTAL: .1.3.6.1.4.1.1602.1.11.1.3.1.4.102
#COLOR: .1.3.6.1.4.1.1602.1.11.1.3.1.4.106
#B/W: .1.3.6.1.4.1.1602.1.11.1.3.1.4.109
#SERIAL: .1.3.6.1.2.1.43.5.1.1.17.1
#TOTAL SOME C2020: .1.3.6.1.4.1.1602.1.11.1.3.1.4.101
@pemitic
pemitic / NetworkChecker.bat
Last active March 20, 2024 08:59 — forked from CallumWatkins/NetworkChecker.bat
A batch file to periodically check your internet connection, restart on failed connection and write to log. License: MIT
@echo off
mode con: cols=55 lines=12
title Network Checker
REM Server to be pinged
SET server=google.co.uk
REM Size of packet to be send to server (bytes)
SET packetSize=1
REM Network info
SET netSSID=[SSID]
<?php
/*
Function to import image from URL to WordPress media library and assign to a post
@params
$post_id - The post ID for which you need to assign the uploaded image as featured image
$image_url - The external image URL which needs to be imported to WordPress media library
*/
function import_featured_image_from_url( $post_id = '', $image_url ='' ) {
//Check both post_id and image_url is not empty
if($post_id == '' || $image_url == '') {
@pemitic
pemitic / mailserver.md
Last active February 4, 2023 10:11 — forked from opentaq/mailserver.md
Mailserver Installation
@pemitic
pemitic / .. MediaCreationTool.bat ..md
Created October 12, 2021 09:18 — forked from AveYo/.. MediaCreationTool.bat ..md
Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1507 to 21H1 with business (Enterprise) edition support

We did it! We broke gist.github.com ;) So head over to the new home! Thank you all!

Not just an Universal MediaCreationTool wrapper script with ingenious support for business editions,
Preview
A powerful yet simple windows 10 / 11 deployment automation tool as well!

configure via set vars, commandline parameters or rename script like iso 21H2 Pro MediaCreationTool.bat
recommended windows setup options with the least amount of issues on upgrades set via auto.cmd
awesome dialogs with keyboard focus to pick target version and preset action

@pemitic
pemitic / Dockerfile
Created September 21, 2020 08:19 — forked from peter279k/Dockerfile
This is Docker image about the PHP+MSSQL enviroment
# Install required packages
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-get install -y python-software-properties
RUN LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
RUN apt-get update
RUN apt-get install -y apt-transport-https apt-utils curl php7.1-cli php7.1-mysql php7.1-curl
RUN apt-get install -y php7.1-xml php7.1-dom php7.1-xsl php7.1-json php7.1-odbc php7.1-dev
RUN apt-get install -y libcurl3-openssl-dev
@pemitic
pemitic / Win10HometoPro.cmd
Created August 8, 2020 10:50 — forked from CHEF-KOCH/Win10HometoPro.cmd
Convert Windows 10 Home to Pro
cscript.exe %windir%\system32\slmgr.vbs /rilc
cscript.exe %windir%\system32\slmgr.vbs /upk
cscript.exe %windir%\system32\slmgr.vbs /ckms
cscript.exe %windir%\system32\slmgr.vbs /cpky
cscript.exe %windir%\system32\slmgr.vbs /ipk VK7JG-NPHTM-C97JM-9MPGT-3V66T
sc config LicenseManager start= auto & net start LicenseManager
sc config wuauserv start= auto & net start wuauserv
clipup -v -o -altto c:\
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove -y
apt-get -y install build-essential wget curl gcc make wget tzdata git libreadline-dev libncurses-dev libssl-dev zlib1g-dev
wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.32-9731-beta/softether-vpnserver-v4.32-9731-beta-2020.01.01-linux-x64-64bit.tar.gz
tar xzf softether-vpnserver-v4.32-9731-beta-2020.01.01-linux-x64-64bit.tar.gz && rm softether-vpnserver-v4.32-9731-beta-2020.01.01-linux-x64-64bit.tar.gz
cd vpnserver && sudo make
cd ..
sudo mv vpnserver /usr/local && cd /usr/local/vpnserver/
sudo chmod 600 *
@pemitic
pemitic / Start-FileSystemWatcher.ps1
Created November 8, 2018 09:03 — forked from mobzystems/Start-FileSystemWatcher.ps1
Using a FileSystemWatcher from PowerShell
# Start-FileSystemWatcher.ps1 - File System Watcher in Powershell.
# Brought to you by MOBZystems, Home of Tools
# https://www.mobzystems.com/code/using-a-filesystemwatcher-from-powershell/
[CmdletBinding()]
Param(
# The path to monitor
[Parameter(Mandatory=$true, Position=0)]
[string]$Path,
# Monitor these files (a wildcard)