Skip to content

Instantly share code, notes, and snippets.

@imiric
imiric / flacsplit.sh
Last active February 27, 2017 14:35
#!/bin/bash
# Split a FLAC file (including HD/96kHz) into individual files using a cue sheet
# Source: http://unix.stackexchange.com/a/63976/44047
cue_file="$1"
aud_file="$2"
time[0]="00:00.00"
c=1
for ts in $(cuebreakpoints "${cue_file}"); do
time[${c}]=${ts}
c=$((c+1))
@mickey06
mickey06 / gist:4770903
Created February 12, 2013 16:00
Flask login with wtfoms validation
class LoginForm(flask_wtf.Form):
"""
Validate login from
"""
email_validator = [flask_wtf.Required()]
pwd_validator = [flask_wtf.Required(), flask_wtf.Length(2)]
email = flask_wtf.TextField(u'email', validators=email_validator)
password = flask_wtf.PasswordField(u'password', validators=pwd_validator)
submit = flask_wtf.SubmitField("Login")
@dergachev
dergachev / README.md
Created October 10, 2012 16:49
Vagrant tutorial

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@ibeex
ibeex / auth.py
Created October 14, 2011 20:04
Python LDAP (ActiveDirectory) authentication
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%s@xxx.xx' % username