Skip to content

Instantly share code, notes, and snippets.

@pavelanni
pavelanni / dynamodb_types.py
Created January 31, 2018 18:47
DynamoDB field types
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table("users")
response = table.get_item()
response = table.get_item(Key={
'user_id': 'REDACTED',
'user_name': 'John'
})
for k in response['Item'].keys():
@pavelanni
pavelanni / ping-led.py
Last active January 20, 2018 20:30
This Raspberry Pi script pings a specific host and if it's up it turns the LED on
#!/usr/bin/env python3
#
# This script pings a site specified in the command line and
# turns the LED on if the site is on. It should be run as root because
# it uses sockets in the ping implementation below.
#
# Code for ping below is borrowed from https://gist.github.com/pyos/10980172
#
import time
import random
@pavelanni
pavelanni / naming_sequence.yml
Last active December 20, 2017 03:56
Create sequential file names or EC2 instance tags with Ansible
---
- name: naming sequence
connection: local
hosts: localhost
vars:
- names: ['cs','cs','cs','cs','cs',]
- numbers: []
- n_instances: 5
@pavelanni
pavelanni / solarize.sh
Created March 13, 2017 22:41 — forked from codeforkjeff/solarize.sh
shell script for setting gnome-terminal color palette to use Solarized theme
#!/bin/sh
#
# Shell script that configures gnome-terminal to use solarized theme
# colors. Written for Ubuntu 11.10, untested on anything else.
#
# Solarized theme: http://ethanschoonover.com/solarized
#
# Adapted from these sources:
# https://gist.github.com/1280177
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/