Skip to content

Instantly share code, notes, and snippets.

@kostecky
kostecky / 0000_hello_world.md
Created May 30, 2023 17:00 — forked from grifx/0000_hello_world.md
Create your own roadmaps from roadmap.sh with checkboxes on GIST

Hello,

My SO is learning coding. I wanted a convenient way for her to consume the content from roadmap.sh.

I hope it can help someone else.

If you want your own roadmap:

  1. Fork or Copy-paste the md files you are interested in your own gist.
@kostecky
kostecky / torrent_vpn_control.sh
Last active March 7, 2016 14:05
Launch with `flock -n /var/run/torrent_vpn_control.pid /root/torrent_vpn_control.sh` out of crontab every minute
#!/bin/ash
last_vpn_up=-1
count=0
while :; do
ip route list | grep -q "default via .* dev tun0"
vpn_up=$?
count=$(($count+1))
@kostecky
kostecky / get_resource_info.rb
Created December 10, 2015 00:58
Puppet custom function to return information about a resource_type as a puppet data structure
run_drequire 'puppet/parser/functions'
Puppet::Parser::Functions.newfunction(:get_resource_info,
:type => :rvalue,
:doc => <<-'ENDOFDOC'
Takes a resource name and returns a puppet structure of information about that resource
as documented in https://docs.puppetlabs.com/references/3.6.2/man/resource_type.html and
http://docs.puppetlabs.com/puppet/latest/reference/http_api/http_resource_type.html
This function relies on a puppet face to parse the class definitions in the module paths as
@kostecky
kostecky / capistrano_haproxy_rolling_deploy.rb
Last active March 26, 2018 20:10
Capistrano rolling deploy with haproxy
# Create a map of the deploy server to the haproxy label
server 'A.A.A.A', proxy_label: 'server-01'
server 'B.B.B.B', proxy_label: 'server-02'
# Define our puppet proxy server(s) and role
server 'C.C.C.C', no_release: true, roles: [:proxy]
# We need to override deploy:symlink:linked_dirs
# No way around it - override deploy:symlink:release and rewrite it for rolling deploys
Rake::Task["deploy:symlink:release"].clear_actions
@kostecky
kostecky / gist:f8814178b3367219544e
Last active August 29, 2015 14:07
nginx / unicorn rack middleware to get a client cert to the puppetmaster
class String
def in_groups_of(n)
chars.each_slice(n).map(&:join).join("\n")
end
end
class SSL_Middleware
def initialize(app, options = {})
@app = app
@options = options
@kostecky
kostecky / swift-df.py
Last active December 17, 2015 16:29 — forked from chmouel/swift-df.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2013 eNovance SAS <[email protected]>
#
# Author: Chmouel Boudjnah <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#