Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
sanitary deeds done at reasonable prices

Ilkka Poutanen ilkka

:octocat:
sanitary deeds done at reasonable prices
View GitHub Profile
@ilkka
ilkka / Set-BotoCredentials.ps1
Created Dec 11, 2017
PowerShell cmdlet for writing an awscli/boto credentials file when you used AWS PowerShell tools to store your creds
View Set-BotoCredentials.ps1
# Drop this in your profile file and you're good to go.
# Creating ~\.aws\credentials file from creds stored in the aws powershell tools
function Set-BotoCredentials {
[CmdletBinding()]
param (
[parameter()]
[string]
$ProfileName = 'default'
)
@ilkka
ilkka / Grant-ECRAccess.ps1
Last active Dec 11, 2017
PowerShell cmdlet for having Docker log in to ECR
View Grant-ECRAccess.ps1
# Install the AWS tools for PowerShell, then drop this in e.g. your profile file.
# As a bonus it exports `$Env:ECRHOST` which you can use when e.g. tagging or
# pushing images.
function Grant-ECRAccess {
[CmdletBinding()]
param (
[parameter()]
[string]
$ProfileName = 'default',
@ilkka
ilkka / Update-VirtualEnvShims.ps1
Created Dec 11, 2017
Script for creating/updating shim PowerShell scripts that transparently run your Python scripts.
View Update-VirtualEnvShims.ps1
# Just drop this in the 'Scripts' directory in your virtualenv and run it.
$Dir = Split-Path ((Get-Variable MyInvocation).Value).MyCommand.Path
$Scripts = Get-ChildItem $Dir | Where-Object {($_.name -match '\.py$') -and ($_.name -notmatch '^activa
te')}
foreach ($Script in $Scripts) {
Write-Output "python $($Script.Fullname) @args" | Out-File ($Script.Fullname -replace '\.py$','.ps1')
}
@ilkka
ilkka / boxstarter.ps1
Last active Sep 29, 2017 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
View boxstarter.ps1
# Description: Boxstarter Script, forked from Jessie Frazelle's verseion
# Author: Ilkka <ilkka@ilkka.io>
# Last Updated: 2017-09-26
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
View openstack-to-ssh-config.jq
#!/usr/bin/env jq -r -f
._meta.hostvars[] |
select(.openstack.metadata.Group | contains("my-host-group"))? |
("Host " + .openstack.name + "\n Hostname " + .ansible_host + "\n User myusername")
@ilkka
ilkka / dummy.test.js
Created Mar 5, 2017
Default mocha config, all files go in `./test/`
View dummy.test.js
describe("dummy", function () {
before(function() {
console.log("dummy before");
});
it("is a dummy", function() {
console.log("dummy test");
});
});
@ilkka
ilkka / random.fish
Created Feb 27, 2017
Get random unsplash wallpaper for mac in your display's resolution
View random.fish
#!/usr/bin/env fish
if not command -s system_profiler >/dev/null
echo "system_profiler not found" ^&2
exit 1
else if not command -s osascript >/dev/null
echo "osascript not found" ^&2
exit 1
else if not command -s xmlstarlet >/dev/null
echo "xmlstarlet not found" ^&2
exit 1
@ilkka
ilkka / resolutions.sh
Created Feb 27, 2017
Get the resolutions of all connected mac OS displays
View resolutions.sh
# Prerequisites: brew install xmlstarlet
system_profiler -xml SPDisplaysDataType \
| xmlstarlet sel -t -v "//array/dict/key[. = '_spdisplays_pixels']/following-sibling::string[1]" 2>/dev/null
@ilkka
ilkka / Vagrantfile
Created Oct 7, 2015
multi machine Vagrantfile with provisioning
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define 'first' do |first|
first.vm.box = "trusty-server-cloudimg-i386"
first.vm.hostname = "first"
first.vm.provision "shell", inline: <<-SHELL
echo "this runs only in 'first', now in `hostname`"
SHELL
@ilkka
ilkka / README.md
Created Apr 1, 2015
GitLab + Jenkins in one command
View README.md

GitLab + Jenkins in one command

$ docker-compose up

Here's a Docker Compose config file that'll give you Gitlab (SSH on 10022, HTTP on 10080) and Jenkins (HTTP on 10081) running and connected. Just add the GitLab CI and Git plugins to Jenkins and you're good to go.

Note that when setting Jenkins as your GitLab CI on the GitLab side, you have to use the container's IP since the link only goes the other way. Also GitLab can't send emails as is, I'm working on that.

You can’t perform that action at this time.