Skip to content

Instantly share code, notes, and snippets.

View glennsarti's full-sized avatar
✍️
Writing code that's soon to be legacy...

Glenn Sarti glennsarti

✍️
Writing code that's soon to be legacy...
View GitHub Profile
@glennsarti
glennsarti / ConvertJSONToCypher.ps1
Created July 10, 2015 04:04
These two scripts can be used to convert the data from the Star Wars API (http://swapi.co) into an import file for Neo4j. These scripts download the JSON data from the API and converts it into Cypher statements. It's crude and probably not the best way to do it, but, it works!. Firstly download the JSON data using GetSWAPI.ps1, and then run Conv…
$ErrorActionPreference = 'Stop'
$VerbosePreference = 'SilentlyContinue'
Function Safe-CypherString($value) {
$value = $value.Replace('\','\\').Replace("`n",'\n').Replace("`r",'\r').Replace("'","\'")
Write-Output $value
}
Function Convert-JSONToCypher($dataObject) {
@ECHO OFF
ECHO Installing chocolatey...
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
ECHO Refreshing env...
CALL "C:\ProgramData\chocolatey\bin\RefreshEnv.cmd"
ECHO Installing Chrome and VC Redist 2010...
choco install googlechrome vcredist2010 -y
@glennsarti
glennsarti / RunTest.BAT
Last active March 7, 2016 17:20
Automated testing for MSIs on VM Pooler for PA-231
@ECHO OFF
SETLOCAL
SET COMP=<poolername>.delivery.puppetlabs.net
SET UNAME=administrator
SET PWD=<password>
NET USE \\%COMP%\c$ /user:%UNAME% %PWD%
# Powershell specific argument passing
# You must be on the latest beta of chocolatey for this to work properly (redownload files)
# Based on https://gist.github.com/ferventcoder/947479688d930e28d632
#TODO
#uru 1.9.3
#gem sources -a http://rubygems.org
#gem sources -r https://rubygems.org
#gem update --system
#gem sources -r http://rubygems.org
@glennsarti
glennsarti / GetPR.BAT
Last active July 14, 2016 22:44
Dev Environment Scripts
@ECHO OFF
SETLOCAL
SET /P PROJECT=Enter project name (e.g. puppet):
SET /P PRNUM=Enter PR number (e.g. 12345):
SET REPO=%~dp0%PROJECT%-pr%PRNUM%
ECHO Cleaning...
@glennsarti
glennsarti / Mass modsync
Created July 7, 2016 17:58
Mass modsync
bundle exec msync update -f "acl|powershell|reboot|registry|sqlserver|wsus_client" -n glennsarti -b stable -m "(maint) modulesync 724153ca2" -r ticket/stable/PUP6473
bundle exec msync update -f “choco|dism|dsc” -n glennsarti -b master -m "(maint) modulesync 724153ca2" -r ticket/master/PUP6473
@glennsarti
glennsarti / Fresh Ubutnu 14.04
Last active October 20, 2018 01:56
Installing Ruby for puppet windows devs on WSL on Win10
sudo apt-get install -y build-essential git libreadline-dev
sudo apt-get install -y libssl-dev zlib1g-dev
sudo apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
sudo apt-get install -y ruby1.9.1-dev zlib1g-dev
sudo apt-get install -y autoconf
sudo apt-get install -y libicu-dev
@glennsarti
glennsarti / Gemfile
Created August 1, 2016 21:15
Sync Production to Staging Puppet Forges
source ENV['GEM_SOURCE'] || "https://rubygems.org"
# Determines what type of gem is requested based on place_or_version.
def gem_type(place_or_version)
if place_or_version =~ /^git:/
:git
elsif place_or_version =~ /^file:/
:file
else
:gem
@glennsarti
glennsarti / build-win.cmd
Created August 2, 2016 04:04
Build DSC package
@ECHO OFF
SETLOCAL
choco install 7zip -y
ECHO Cleaning...
RD "%~dp0pkg" /s/q
ECHO Building the puppet module...
@glennsarti
glennsarti / jjb_installer.sh
Created August 22, 2016 21:32
Python for CJC-Manager for BashOnWindows
# Install python packages
sudo apt-get install python python-pip python-virtualenv
# Install python dev packages
sudo apt-get install python-dev libxml2-dev libxslt-dev