Skip to content

Instantly share code, notes, and snippets.

View steenzout's full-sized avatar

Pedro steenzout

View GitHub Profile
@alairock
alairock / lastfm-collage.txt
Created April 18, 2017 15:04
Create a collage with Python Image Library and LastFM's API
import random
from PIL import Image, ImageDraw, ImageFont
import requests
import sys
import urllib
from pprint import pprint
url = "http://ws.audioscrobbler.com/2.0/"
body = {
'method': "user.gettopartists",
@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@steenzout
steenzout / ansible_tests.yml
Last active September 19, 2016 20:17
Compilation of ansible tasks useful to setup testing.
- name: is X package installed?
command: dpkg-query -W -f='${Status}\n' X
register: test
changed_when: no
failed_when: test.stdout.find('install ok installed') == -1
- name: file is present?
command: test -e path_to_file
changed_when: no
@josephspurrier
josephspurrier / sshclient.go
Last active September 10, 2022 02:23
Golang SSH Client
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@iamralch
iamralch / compress.go
Last active April 16, 2023 03:04
ZIP archives in Golang
import (
"archive/zip"
"io"
"os"
"path/filepath"
"strings"
)
func zipit(source, target string) error {
zipfile, err := os.Create(target)
@iamralch
iamralch / ssh_client.go
Last active April 16, 2023 03:09
SSH client in GO
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strings"
@mfriedenhagen
mfriedenhagen / password_from_keyring.py
Last active January 3, 2018 05:14
A simple keyring based password provisioner for ansible
"""
Store this file as `vars_plugins/password_from_keyring.py` and specify the
following in `ansible.cfg`:
```
[defaults]
vars_plugins=./vars_plugins
```
In your inventory specify:
#!/bin/bash
# GUI-related packages
pkgs="
xserver-xorg-video-fbdev
xserver-xorg xinit
gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa
gstreamer1.0-libav
epiphany-browser
@ikennaokpala
ikennaokpala / _.sh
Last active June 10, 2021 07:24
Starting up and Monitoring a Golang binary in production
# Make it executable
sudo chmod +x etc/init.d/myapp
# Try it:
sudo service myapp start
# Make it run upon boot:
sudo update-rc.d myapp defaults
@steenzout
steenzout / ansible_update_roles.md
Last active August 29, 2015 14:10
Poor man's Ansible role update