Skip to content

Instantly share code, notes, and snippets.

View echohack's full-sized avatar
🎥
twitch.tv/echohack

echohack echohack

🎥
twitch.tv/echohack
View GitHub Profile
security find-certificate -c "Izenpe.com" -a -Z "/System/Library/Keychains/SystemRootCertificates.keychain"| grep SHA-1 | awk '{print $NF}'
sudo security delete-certificate -Z 30779E9315022E94856A3FF8BCF815B082F9AEFD -t "/System/Library/Keychains/SystemRootCertificates.keychain"
security find-certificate -c "certificatename" -a -Z | \
sudo awk '/SHA-1/{system("security delete-certificate -Z "$NF)}'
@echohack
echohack / samba_share_recipe.rb
Created October 1, 2015 19:40
Install a nuget package from a Windows Samba share
# Use this to mount a samba share on windows and install a nuget package
# Mounting samba shares sucks. Use an artifact repository to store binaries.
# But sometimes you don't have a choice...
include_recipe 'chocolatey'
mount 'n:' do
device '\\\\fqdn\\remotepath'
password 'password'
domain 'my_domain'
@echohack
echohack / dsc_gotchas.rb
Last active October 7, 2015 20:43
dsc gotchas
if (platform_family? 'windows') && (node['kernel']['name'] == 'Microsoft Windows Server 2012 R2 Standard')
# Apply the Local Configuration Manager for DSC.
# DSC by default runs a consistancy check once every 15 minutes.
# Disable this because it causes collisions with chef-client runs.
powershell_script 'apply_lcm' do
code <<-EOH
configuration LCM
{
LocalConfigurationManager
@echohack
echohack / dsc_script.rb
Last active October 7, 2015 20:29
dsc_script example
iis_ws_config = "#{node['app']['file_cache_path']}\\iis_ws_config.ps1"
template iis_ws_config do
source 'iis_ws_config.ps1.erb'
variables(
ws_pool_user: env_credentials['ws_pool_user'],
ws_pool_pswd: env_credentials['ws_pool_pswd'],
site_name: ws['site_name'],
site_path: ws['site_path'],
formservice_path: ws['formservice_path'],
formsetservice_path: ws['formsetservice_path'],
@echohack
echohack / iis_ws_config.ps1.erb
Last active October 7, 2015 20:33
iis_ws_config
configuration iis_ws_config
{
Import-DscResource -Module xWebAdministration
xWebsite DefaultWebSite
{
Name = "<%= @site_name %>"
Ensure = "Present"
PhysicalPath = "<%= @site_path %>"
State = "Started"
@echohack
echohack / jenkins_plugins.rb
Last active February 12, 2016 20:26
A Chef Recipe that installs jenkins plugins
# Install these plugins
# Uses the Jenkins cookbook available from the Chef Supermarket
# All plugins from https://updates.jenkins-ci.org/download/plugins/
node.set['_jenkins']['plugins'] = [
{ name: 'active-directory', source: 'https://updates.jenkins-ci.org/download/plugins/active-directory/1.33/active-directory.hpi' },
{ name: 'artifactory', source: 'https://updates.jenkins-ci.org/download/plugins/artifactory/2.2.3/artifactory.hpi' },
{ name: 'build-monitor-plugin', source: 'https://updates.jenkins-ci.org/download/plugins/build-monitor-plugin/1.6+build.132/build-monitor-plugin.hpi' },
{ name: 'build-name-setter', source: 'https://updates.jenkins-ci.org/download/plugins/build-name-setter/1.3/build-name-setter.hpi' },
{ name: 'countjobs-viewstabbar', source: 'https://updates.jenkins-ci.org/download/plugins/countjobs-viewstabbar/1.0.0/countjobs-viewstabbar.hpi' },
{ name: 'downstream-ext', source: 'https://updates.jenkins-ci.org/download/plugins/downstream-ext/1.8/downstream-ext.hpi' },
@echohack
echohack / windows_features.ps1.erb
Created April 25, 2016 19:21
Install all the windows features from Chef
configuration windows_features
{
foreach ($feature in @(<% node['windows_base']['features'].each_with_index do |feature, index| %>
'<%= feature %>'<% if index != node['windows_base']['features'].size - 1 %>,<% end %><% end %>))
{
WindowsFeature $feature
{
Ensure = 'Present'
Name = $feature
}
@echohack
echohack / iis_web_config.ps1.erb
Created April 25, 2016 19:24
Example web config for iis using dsc + chef
configuration iis_web_config
{
Import-DscResource -Module xWebAdministration
xWebsite DefaultWebSite
{
Name = "<%= @site_name %>"
Ensure = "Present"
PhysicalPath = "<%= @site_path %>"
State = "Started"
@echohack
echohack / git_status.sh
Created November 18, 2016 23:26
Recursive git status
find . -type d -name '.git' | while read dir ; do sh -c "cd $dir/../ && echo -e \"\nGIT STATUS IN ${dir//\.git/}\" && git status -s" ; done
@echohack
echohack / convert_ogg_to_mp3.sh
Created May 4, 2017 07:10
Use ffmpeg to convert all ogg files in a folder to mp3
for name in *.ogg; do ffmpeg -i "$name" -ab 128k -map_metadata 0:s:0 "${name/.ogg/.mp3}"; done;