Skip to content

Instantly share code, notes, and snippets.

Val Neekman un33k

View GitHub Profile
View autorun-plexconnect.sh
#!/bin/sh
# /share/MD0_DATA/.qpkg/autorun/autorun-plexconnect.sh
# chmod +x /share/MD0_DATA/.qpkg/autorun/autorun-plexconnect.sh
curl -L https://gist.github.com/tommeier/6255771/raw/update_plex_connect.sh | bash &
View Install_tmux
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@un33k
un33k / fabonocci.py
Created Apr 23, 2014
Simple Fabonocci Sequence Creator
View fabonocci.py
def F():
a,b = 0,1
yield a
yield b
while True:
a, b = b, a + b
yield b
def F2():
@un33k
un33k / word_counter.py
Created Apr 23, 2014
Given a list of words, count the occurrence of each group of characters in any order that they might appear. Example: foo, ofo, oof are all counting towards foo = 3
View word_counter.py
words = """
is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum pass
View app.js
'use strict';
// Declare app level module which depends on filters, and services
var app= angular.module('myApp', ['ngRoute']);
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'loginCtrl'});
$routeProvider.otherwise({redirectTo: '/login'});
}]);
View MainCtrl.js
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
@un33k
un33k / whisper
Created Apr 29, 2014
Keeps the startup office whisper quiet
View whisper
#!/usr/bin/env python
import sys
import cgi
import getopt
import urlparse
import socket
from subprocess import call, Popen, PIPE
from wsgiref.util import setup_testing_defaults, request_uri
from wsgiref.simple_server import make_server
@un33k
un33k / any_encoding.py
Created Jul 11, 2014
Open files of different encoding type automatically.
View any_encoding.py
import codecs
# pip install chardet
file_location = './sometestfile.log'
from chardet.universaldetector import UniversalDetector
def get_file_encoding_type(filename):
"""
@un33k
un33k / django-choices-coversion.py
Created Aug 28, 2014
string to integer AND integer to string conversions for Django Options
View django-choices-coversion.py
def choices_txt_2_int(choices, text, default=0):
"""
Returns the integer `value` of a text from a choice tuple or `default`.
"""
value = default
if isinstance(text, str):
try:
value = next(v for v, k in choices if k.lower()==text.lower())
except StopIteration:
pass
View patch-edid.rb
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
You can’t perform that action at this time.