Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@primeinc
primeinc / mkinstance.sh
Last active August 29, 2015 14:08 — forked from jarvys/run-multiple-redis-instances.md
run multiple redis instances on the same server for centos 6.5 using Redis 2.8 from Remi
#!/usr/bin/env bash
# will@prime.ms | Updated: 10/31/14
# usage: ./mkinstance.sh -h
# Based on the Redis 2.8.17-2.el6.remi
# TODO: Add overwrite arg for base conf
# TODO: Grab all replacements for sed from base conf file, currently assumes too many defaults
# TODO: Handle removal if instance was already removed once before
conf="/etc/redis.conf"
confdir=$(dirname "$conf")
@primeinc
primeinc / lightNotify.lua
Last active August 4, 2016 19:50
Blink the lights on a dimmer switch quickly
--> Configuration Variables
local Device = 16; local Secs = 1; local count = 0
local targetCount = 4; local targetLoadHigh = 100; local targetLoadLow = 10
--> End Configuration Variables
local switchOnOff = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", Device);
local lightLevel = luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", Device);
local Call ='urn:upnp-org:serviceId:Dimming1';Do ='SetLoadLevelTarget';Nil =""
local BlinkOn, BlinkOff, restoreLevel
if Run == nil then Run = 0 end
function BlinkOn(Call)
@primeinc
primeinc / deployHA.ps1
Last active December 27, 2016 00:15
Home Assistant install on Windows 2016 NanoServer
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$targetComputer = $(throw "targetComputer is mandatory, please provide a value."),
[string]$PythonInstallPath = “$env:LOCALAPPDATA\Programs\Python\Python35”,
[string]$tz = "Eastern Standard Time"
)
Write-Progress -Activity "Deploying Home Assistant" -Status 'Connecting to remote computer..';
@primeinc
primeinc / Thaumcraft-InvTweaksTree.txt
Last active June 9, 2020 10:25
Thaumcraft Inventory Tweaks for InvTweaksTree
<thaumcraft>
<thaumcraftAerCrystal id="thaumcraft:crystal_essence" data='{Aspects:[{amount:1,key:"aer"}]}'/>
<thaumcraftTerraCrystal id="thaumcraft:crystal_essence" data='{Aspects:[{amount:1,key:"terra"}]}'/>
<thaumcraftIgnisCrystal id="thaumcraft:crystal_essence" data='{Aspects:[{amount:1,key:"ignis"}]}'/>
<thaumcraftAquaCrystal id="thaumcraft:crystal_essence" data='{Aspects:[{amount:1,key:"aqua"}]}'/>
<thaumcraftOrdoCrystal id="thaumcraft:crystal_essence" data='{Aspects:[{amount:1,key:"ordo"}]}'/>
<thaumcraftPerditioCrystal id="thaumcraft:crystal_essence" data='{Aspects:[{amount:1,key:"perditio"}]}'/>
<thaumcraftVacuosCrystal id="thaumcraft:crystal_essence" data='{Aspects:[{amount:1,key:"vacuos"}]}'/>
<thaumcraftLuxCrystal id="thaumcraft:crystal_essence" data='{Aspects:[{amount:1,key:"lux"}]}'/>
<thaumcraftMotusCrystal id="thaumcraft:crystal_essence" data='{Aspects:[{amount:1,key:"motus"}]}'/>
@primeinc
primeinc / Readme.md
Last active November 3, 2020 06:49 — forked from ciotlosm/Readme.md
Kiosk mode for lovelace

Kiosk mode

Installation

Add kiosk.js file with the content below to your www folder in config.

Like any other custom script, use ui-lovelace.yaml resources section to reference the kiosk.js file.

Make sure you add kiosk somewhere in your URL. You can use it in the id of your view or in the query string.

@primeinc
primeinc / cyberpower_pdu_snmp_reboot.ps1
Created December 14, 2021 18:13
Quick and dirty SNMP command to turn on and off an outlet using powershell / windows
# Quick and dirty SNMP command to turn on and off an outlet using powershell / windows
#.iso.org.dod.internet.private.enterprises.cps.products.hardware.ePDU.ePDUOutlet.ePDUOutletControl.ePDUOutletControlTable.ePDUOutletControlEntry.ePDUOutletControlOutletCommand
# .1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4
# .1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.5 for outlet number 5
$SNMP = New-Object -ComObject olePrn.OleSNMP
$SNMP.open('192.168.10.100','private',2,1000)
#$RESULT = $SNMP.Get(".1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.5")
$ACTION = 3
if (Storage::disk('local')->exists($sqlFilePath)) {
try {
$fileContent = Storage::disk('local')->get($sqlFilePath);
} catch (\Exception $e) {
dd('Whoops: ' . $e->getMessage());
}
if(!$fileContent) {
throw new \Exception("SQL File is empty: {$sqlFilePath}");
}
<?php
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Storage;
class DatabaseSeeder extends Seeder
{
@primeinc
primeinc / webui.sh
Last active March 7, 2023 05:33
SD-Automatic-Root-Script
#!/usr/bin/env bash
#########################################################
# Uncomment and change the variables below to your need:#
#########################################################
# Check if COMMANDLINE_ARGS is set
if [[ -z "${COMMANDLINE_ARGS}" ]]; then
export COMMANDLINE_ARGS="--share --disable-safe-unpickle --enable-insecure-extension-access \
--no-half-vae --no-half --xformers --no-hashing --disable-console-progressbars \
--no-download-sd-model --api --allow-code --theme dark"