Skip to content

Instantly share code, notes, and snippets.

View SmugZombie's full-sized avatar

Ron Egli SmugZombie

View GitHub Profile
@SmugZombie
SmugZombie / Simple_GMT_JavascriptClock.js
Created September 27, 2016 22:15
Simple GMT Javascript Clock
<script>
function getTime() {
var dt = new Date();
var def = dt.getTimezoneOffset()/60;
var gmt = (dt.getHours() + def);
var ending = ":" + IfZero(dt.getMinutes()) + ":" + IfZero(dt.getSeconds());
var _GMT =check24(((gmt) > 24) ? ((gmt) - 24) : (gmt));
var mount =check24(((gmt + (24-7)) > 24) ? ((gmt + (24-7)) - 24) : (gmt + (24-7)));
var times = [];
times['gmt'] = (IfZero(_GMT) + ":" + IfZero(dt.getMinutes()) + ":" + IfZero(dt.getSeconds())) + " (GMT -0)";
<script>
var loading= false;
$(window).scroll(function() {
if (!loading && ($(window).scrollTop() > $(document).height() - $(window).height() - 100)) {
loading= true;
// your content loading call goes here.
loading = false; // reset value of loading once content loaded
@SmugZombie
SmugZombie / sleep.ahk
Created October 12, 2016 03:50
Simple AHK sleep to Python Sleep
sleep(int){
sleep (int * 1000)
}
Exe("C:\Temp\MyScript.ahk")
Exe(file){
Loop,%file%
Filename:=RegExReplace(A_LoopFileShortName,"\.[^\.]*$")
Loop,%A_AhkPath%
path:=A_LoopFileDir
FileMove,%A_AhkPath%,%path%\%FileName%.exe
If ErrorLevel
Return ErrorLevel
ValidIP(ByRef IPAddress)
{
if (StrLen(IPAddress) > 15)
Valid=0
IfInString, IPAddress, %A_Space%
Valid=0
StringSplit, Octets, IPAddress, .
if (Octets0 <> 4)
@SmugZombie
SmugZombie / EmptyMem.ahk
Created October 15, 2016 04:51
Empty Unused Memory
EmptyMem(PID="AHK Rocks"){
pid:=(pid="AHK Rocks") ? DllCall("GetCurrentProcessId") : pid
h:=DllCall("OpenProcess", "UInt", 0x001F0FFF, "Int", 0, "Int", pid)
DllCall("SetProcessWorkingSetSize", "UInt", h, "Int", -1, "Int", -1)
DllCall("CloseHandle", "Int", h)
}
@SmugZombie
SmugZombie / RunCommand.c#
Created October 18, 2016 21:23
Simple Run Function in C# - Runs and returns response as a variable
private static string RunCommand(string command, string arguments)
{
Process process = new Process();
process.StartInfo.FileName = command;
process.StartInfo.Arguments = arguments;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.Start();
// Synchronously read the standard output of the spawned process.
# Single File Output
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'compressed': True}},
windows = [{'script': "syslog.py"}],
zipfile = None,
)
@SmugZombie
SmugZombie / obj2array.js
Created December 6, 2016 17:41
Basic Object to Array
function obj2array(object){
x = [];
for( var i in object ) {
x[i] = object[i];
}
return x;
}
@SmugZombie
SmugZombie / hex2a.js
Created December 6, 2016 17:43
Converts hex to string.
function hex2a(hex) {
var str = '';
for (var i = 0; i < hex.length; i += 2) { str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); }
return str;
}