Skip to content

Instantly share code, notes, and snippets.

View mark05e's full-sized avatar

mark05E mark05e

View GitHub Profile
@markembling
markembling / hosts.ps1
Created August 24, 2009 13:38
Powershell script for adding/removing/viewing entries to the hosts file.
#
# Powershell script for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
@michaelfox
michaelfox / chrome-shortcut-manager-settings.js
Created October 8, 2010 05:20
My settings for Chrome shortcut manager extension
// ==UserScript==
// @ShortcutManager
// @name Quix
// @namespace http://www.michaelfox.name
// @key Ctrl+q
// @include *
// ==/UserScript==
javascript:Quix();function%20Quix()%7Bvar%20e=encodeURIComponent;var%20t=window.getSelection?window.getSelection():(document.getSelection?document.getSelection():(document.selection?document.selection.createRange().text:''));var%20c=window.prompt('Quix:%20Type%20%60help%60%20for%20a%20list%20of%20commands:');if(t!='')%7Bif(c)%7Bc+='%20'+t;%7Delse%7Bc=''+t;%7D%7Dif(c)%7Bvar%20u='http://www.quixapp.com/go/?c='+e(c)+'&t='+(document.title?e(document.title):'')+'&s=https://dl.dropbox.com/s/jpc1gu600xunbs5/quix.txt'+'&v=081'+'&u='+(document.location?e(document.location):'');d=''+document.location;if(d.substr(0,4)!='http')%7Bwindow.location=u+'&mode=direct';%7Delse%7Bheads=document.getElementsByTagName('head');if(c.substring(0,1)=='%20')%7Bvar%20w=window.open(u+'&mode=direct');w.focus();%7Delse%20if(heads.length==0)%7Bwindow.location=u+'&mode=direct';%7Delse%7Bq=document.getEle
@williamjacksn
williamjacksn / app_compliance.ps1
Created May 12, 2011 18:50
Application Detection and Compliance with PowerShell
$app_name = "*flash player*"
$app_ver = "10.3.183.5"
$reg_uninstall_keys = "hklm:software\wow6432node\microsoft\windows\currentversion\uninstall", "hklm:\software\microsoft\windows\currentversion\uninstall"
[array]$compliant = (
$reg_uninstall_keys | foreach-object {
if (test-path $_) {
get-childitem $_ | get-itemproperty | select-object displayname, displayversion
}
}
) | where-object {$_.displayname -like $app_name -and $_.displayversion -eq $application_version}
@BrockA
BrockA / waitForKeyElements.js
Created May 7, 2012 04:21
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@tuzz
tuzz / github.css
Last active April 4, 2026 13:49
Github Markdown Stylesheet
/*
Copyright (c) 2017 Chris Patuzzo
https://twitter.com/chrispatuzzo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@makepanic
makepanic / c.log.js
Created September 10, 2012 18:51
console log wrapper
var c = {
/*
* @reference: http://blog.rndm.de/p/console-log-wrapper
* @author: Christian http://rndm.de/
* @license: Licensed under Apache License v2.0. See http://www.apache.org/licenses/LICENSE-2.0
*
* example: c.log("Hello World")
* @param obj - variable to log
* @param trace - boolean display console.trace()
*/
@PiiXiieeS
PiiXiieeS / Insert a progress bar to Powerpoint presentation .md
Last active May 15, 2025 06:35
Insert a progress bar to Powerpoint presentation

Intro

To view the progress of a Powerpoint presentation, a progress bar can be displayed at the bottom of the slide show.

How to proceed

Once the slideshow is complete, go to Tools > Macro > Visual Basic Editor.

In the new window, select Insert > Module and copy this text in the blank page:

Sub AddProgressBar()
    On Error Resume Next
@chrisjhoughton
chrisjhoughton / wait-el.js
Last active December 2, 2025 14:18
Wait for an element to exist on the page with jQuery
var waitForEl = function(selector, callback) {
if (jQuery(selector).length) {
callback();
} else {
setTimeout(function() {
waitForEl(selector, callback);
}, 100);
}
};
@9to5IT
9to5IT / Script_Template.ps1
Last active March 29, 2026 04:44
PowerShell: Script Template
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@nobodyguy
nobodyguy / http_server.ps1
Last active July 9, 2022 15:09
Powershell HTTP server in background thread (could be easily killed)
$ServerThreadCode = {
$listener = New-Object System.Net.HttpListener
$listener.Prefixes.Add('http://+:8008/')
$listener.Start()
while ($listener.IsListening) {
$context = $listener.GetContext() # blocks until request is received
$request = $context.Request