Skip to content

Instantly share code, notes, and snippets.

@zlalanne
zlalanne / install.cmd
Last active August 29, 2015 13:56
Chocolately Install
REM Utilities
cinst 7zip
cinst vlc
cinst adobereader
cinst ccleaner
cinst filezilla
cinst dropbox
cinst virtualbox
cinst ChocolateyGUI
cinst windirstat
@zlalanne
zlalanne / gist:9396756
Created March 6, 2014 18:50
check next entry
values = ["value3", "value2", "value"]
length = len(values)
for ind, item in enumerate(values):
if ind + 1 != length:
if list[ind + 1] == "value":
print("Next one is the value")
@zlalanne
zlalanne / fritzing.desktop
Created March 24, 2014 03:30
Fritzing .desktop entry
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Fritzing
GenericName=Fritzing
Comment=Interactive electronics designing software
Type=Application
Exec=/opt/fritzing/Fritzing
Icon=/opt/fritzing/fritzing_icon.png
Categories=Development
@zlalanne
zlalanne / energia.desktop
Created March 24, 2014 05:52
Energia .desktop entry
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Energia
GenericName=Energia
Comment=Rapid prototyping softare for TI MCUs
Type=Application
Exec=/opt/energia/energia
Icon=/opt/energia/energia_icon.png
Categories=Development
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct card {
unsigned int value;
struct card *next;
} Card_t;
static int AllocateCards(unsigned int numCards, Card_t **deckHead, Card_t **deckTail) {
@zlalanne
zlalanne / bootstrap.sh
Created September 19, 2015 01:51
Start getting my dotfiles setup
#!/usr/bin/env bash
#
# Install ansible and clone dotfiles. Ready to install machine
sudo add-apt-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install git ansible python-pycurl
git clone https://github.com/zlalanne/dotfiles ~/.dotfiles
@zlalanne
zlalanne / Python-AddingSpaces.py
Created May 31, 2013 15:21
Regex for adding spaces after '.' in long string
text = re.sub(r'\.([a-zA-z])', r'. \1', text)
@zlalanne
zlalanne / indent.py
Created June 4, 2013 23:29
Indents XML node in python
def indent(elem, level=0):
"""Add whitespace to xml document to increase readability
elem - root element to start the indention at
level - start level of indention
"""
i = "\n" + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
@zlalanne
zlalanne / HeadphonesID3Tags.py
Created July 27, 2013 21:59
Renames an existing directory of MP3s to the format accepted by the music application Headphones
from sys import argv
from sys import exit
from mutagen.easyid3 import EasyID3
import os
import shutil
def main():
@zlalanne
zlalanne / load_json.py
Last active December 25, 2015 07:29
Quick function to load json from a file in python
def load_json_data(json_filename):
"""
Load a *.json file into a Python dictionary
@param json_filename: path to the json file
@return: a dictionary containing the data
"""
json_file = open(json_filename)
json_data = json_file.read()
test_data = json.loads(json_data)