Skip to content

Instantly share code, notes, and snippets.

View ilkka's full-sized 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 December 11, 2017 10:43
PowerShell cmdlet for writing an awscli/boto credentials file when you used AWS PowerShell tools to store your creds
# 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 December 11, 2017 12:22
PowerShell cmdlet for having Docker log in to ECR
# 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 December 11, 2017 10:01
Script for creating/updating shim PowerShell scripts that transparently run your Python scripts.
# 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 September 29, 2017 07:53 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script, forked from Jessie Frazelle's verseion
# Author: Ilkka <[email protected]>
# 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:
#!/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 March 5, 2017 17:57
Default mocha config, all files go in `./test/`
describe("dummy", function () {
before(function() {
console.log("dummy before");
});
it("is a dummy", function() {
console.log("dummy test");
});
});
@ilkka
ilkka / random.fish
Created February 27, 2017 12:29
Get random unsplash wallpaper for mac in your display's resolution
#!/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 February 27, 2017 12:07
Get the resolutions of all connected mac OS displays
# 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 October 7, 2015 20:40
multi machine Vagrantfile with provisioning
# -*- 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 April 1, 2015 10:54
GitLab + Jenkins in one command

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.