Skip to content

Instantly share code, notes, and snippets.

import os
import sys
# At this point we may be running as root or as another user
# Check the parameters are valid - show an error if not
# Show the help message if requested
if os.geteuid() != 0:
os.execvp("sudo", ["sudo"] + sys.argv)
#!/usr/bin/env python
"""
Copyright 2011 Domen Kozar. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
@ECHO OFF
:LOOPING
set proc=
ECHO "Getting process list"
for /f "delims=" %%a in ('"tasklist | findstr %1"') do @set proc=%%a
ECHO %proc%
IF "%proc%" == "" GOTO START
TIMEOUT 5
AutoItSetOption ("WinTitleMatchMode", 2 )
$window = "[CLASS:IEFrame]"
If not WinExists($window)=1 then;
MsgBox(64, "Not Running", "Internet Explorer is not running")
Else
WinActivate($window)
Send("!D");; selects the address bar contents
Send("^c");; copies it to the clipboard
$fullurl = ClipGet()
AutoItSetOption ("WinTitleMatchMode", 2 )
$window = "[CLASS:MozillaWindowClass]"
If not WinExists($window)=1 then;
MsgBox(64, "Not Running", "Firefox is not running")
Else
WinActivate($window)
Send("^l");; selects the address bar contents
Send("^c");; copies it to the clipboard
$fullurl = ClipGet()
@ECHO OFF
REM Usage - restart-process.bat calc.exe
:LOOPING
REM check is process is running
set proc=
ECHO "Getting process list"
for /f "delims=" %%a in ('"tasklist | findstr %1"') do @set proc=%%a
ECHO %proc%
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop]
"NoChangingWallPaper"=dword:00000001
"NoAddingComponents"=dword:00000001
"NoClosingComponents"=dword:00000001
"NoDeletingComponents"=dword:00000001
"NoEditingComponents"=dword:00000001
#!/bin/bash
### Run as root (or with sudo)
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser testuser
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUID 504
cp -v kcpassword /private/etc/kcpassword
-- Run as : osascript browser_url.scpt "Browser Name"
on run argv
set browser_name to item 1 of argv
tell application "System Events"
if browser_name is "Google Chrome" then
tell application "Google Chrome" to set theURL to URL of active tab of front window
else if browser_name is "Safari" then
tell application "Safari" to set theURL to URL of front document
else if browser_name is "Firefox" then
* Use parental controls from Users and Groups to Limit access applications
* Enable Simple Finder
* Remove the Dock from /System/Library/CoreServices/Dock.app/
* Remove these lines from the file -
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/StandardMenus.nib/objects.xib