Skip to content

Instantly share code, notes, and snippets.

View un33k's full-sized avatar
🎯
Focusing

Val N. un33k

🎯
Focusing
View GitHub Profile
#!/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 &
@un33k
un33k / Install_tmux
Created February 3, 2014 20:01 — forked from simme/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 / word_counter.py
Created April 23, 2014 15:11
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
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
@un33k
un33k / fabonocci.py
Created April 23, 2014 17:49
Simple Fabonocci Sequence Creator
def F():
a,b = 0,1
yield a
yield b
while True:
a, b = b, a + b
yield b
def F2():
@un33k
un33k / app.js
Created April 24, 2014 01:45 — forked from amineeg/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'});
}]);
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 April 29, 2014 15:07
Keeps the startup office whisper quiet
#!/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 July 11, 2014 20:49
Open files of different encoding type automatically.
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 August 28, 2014 17:04
string to integer AND integer to string conversions for Django Options
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
#!/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