Skip to content

Instantly share code, notes, and snippets.

View glombard's full-sized avatar

Gert Lombard glombard

View GitHub Profile
@glombard
glombard / deployment.properties
Created October 30, 2013 10:50
Java Applet Configuration and Registry Settings. This is my development environment settings for testing applet development: security set to MEDIUM and Java Console enabled.
#deployment.properties
#Wed Oct 30 02:55:51 PDT 2013
deployment.security.level=MEDIUM
deployment.javapi.lifecycle.exception=true
deployment.trace=true
deployment.version=7.21
deployment.browser.path=C\:\\Program Files\\Internet Explorer\\iexplore.exe
deployment.modified.timestamp=1383126951687
deployment.expiration.decision.10.45.2=undefined
deployment.log=true
@glombard
glombard / get-curl.ps1
Created November 11, 2013 16:35
PowerShell to download 7za and cURL into the Windows directory
$c=New-Object Net.WebClient
$c.DownloadFile('http://heanet.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7za920.zip',"$env:TEMP\7za920.zip")
$c.DownloadFile('http://www.paehl.com/open_source/?download=curl_733_0_ssl.zip',"$env:TEMP\curl.zip")
$shell=New-Object -Com Shell.Application
$win=$shell.NameSpace($env:windir)
$win.CopyHere($shell.NameSpace("$env:TEMP\7za920.zip").Items(), 16)
$win.CopyHere($shell.NameSpace("$env:TEMP\curl.zip").Items(), 16)
@glombard
glombard / get-WindowsAzurePowershell.bat
Last active December 28, 2015 05:49
Starting an Azure Virtual Machine from the command-line with PowerShell
# Get WebPICmd from: http://go.microsoft.com/fwlink/?LinkId=255386
# Direct download link:
# x64: http://download.microsoft.com/download/7/0/4/704CEB4C-9F42-4962-A2B0-5C84B0682C7A/WebPlatformInstaller_amd64_en-US.msi
# x86: http://download.microsoft.com/download/7/0/4/704CEB4C-9F42-4962-A2B0-5C84B0682C7A/WebPlatformInstaller_x86_en-US.msi
webpicmd /Install /Products:WindowsAzurePowershell /AcceptEula
webpicmd /List /ListOption:Installed | findstr "PowerShell"
# Import-Module "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1"
@glombard
glombard / get-jenkins-git-plugins.ps1
Last active March 18, 2017 03:22
Install Jenkins Git plugins and restart the service.
$plugins = "${env:ProgramFiles(x86)}\Jenkins\plugins"
$c = New-Object Net.WebClient
$c.DownloadFile('http://updates.jenkins-ci.org/download/plugins/git-client/1.4.6/git-client.hpi', "$plugins\git-client.hpi")
$c.DownloadFile('http://updates.jenkins-ci.org/download/plugins/scm-api/0.2/scm-api.hpi', "$plugins\scm-api.hpi")
$c.DownloadFile('http://updates.jenkins-ci.org/download/plugins/git/2.0/git.hpi', "$plugins\git.hpi")
Restart-Service Jenkins
@glombard
glombard / Get-Python33.bat
Created November 16, 2013 19:00
Install Python 3.3 and pip.
@echo off
REM powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://gist.github.com/glombard/7416112/raw/fb317426b2092a41770cf86b50463fb0c2f73706/get-curl.ps1'))"
curl -O http://python.org/ftp/python/3.3.2/python-3.3.2.msi
curl -O http://python-distribute.org/distribute_setup.py
curl -k -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
msiexec /i python-3.3.2.msi /passive /norestart /log %temp%\python-install.log
set PATH=%PATH%;C:\Python33
@glombard
glombard / reference-markdown-metadata-from-jinja-template.py
Last active May 30, 2023 09:19
How to use Markdown as a filter in a Jinja2 template, and then extract the Markdown Meta property directly from the template. Assuming you want to use the Meta-data value before rendering the converted Markdown content (e.g. in the html head), the trick is to render the markdown first, save it to a variable (html_content in this example) using a…
from pprint import pprint
import jinja2
import markdown
HTML_TEMPLATE = """{% macro get_html() %}
{{ content | markdown }}
{% endmacro %}
{% set html_content = get_html() %}
Title from Markdown meta-data: {{ get_title() }}
@glombard
glombard / create-WinXP-vm.ps1
Last active January 11, 2023 03:14
Create Windows XP image on Hyper-V
# Enable RDP on host:
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name fDenyTSConnections -Type DWord -Value 0
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
# Get sublime text editor:
$c=new-object Net.WebClient
$c.DownloadFile('http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20Build%203047%20x64%20Setup.exe',"$env:TEMP\sublime.exe")
cd $env:TEMP
.\sublime.exe /SILENT
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@glombard
glombard / Create-Local-Admin-User.ps1
Created November 27, 2013 19:14
Create a local user on Windows XP using PowerShell and add the user to the local Administrators group.
$computer = [ADSI]"WinNT://ie6winxp"
$u = $computer.Create("User", "test")
$u.SetPassword("test")
$u.put("description", "Test user")
$u.SetInfo()
$group = [ADSI]"WinNT://ie6winxp/Administrators,group"
$group.add("WinNT://ie6winxp/test")
@glombard
glombard / Create-Fake-SNMP-Service.ps1
Created November 28, 2013 13:07
Create a fake Windows Service to fool another program to think the service is already installed... In this case I'm creating the SNMP service to point to the Notepad executable.
New-Service -Name 'SNMP' -BinaryPathName 'C:\windows\notepad.exe' -DisplayName 'Fake SNMP Service' -StartupType Manual