Skip to content

Instantly share code, notes, and snippets.

View un33k's full-sized avatar
🎯
Focusing

Val N. un33k

🎯
Focusing
View GitHub Profile
@un33k
un33k / plex_watchdog.sh
Last active April 6, 2024 13:38
Plex on OSX often falls into a tight loop and consumes %100 of the CPU. This watchdog is to restart Plex to avoid running the CPU hot for an extended period of time.
#!/bin/sh
PLEX_APP='/Applications/Plex Home Theater.app/Contents/MacOS/Plex Home Theater'
COUNT=0
PLEX_CPU=0
LOOP=1
while [ $LOOP -le 14 ] ; do
PLEX_CPU=`ps aux | grep "$PLEX_APP" | awk '{print $3}' | head -n 1`
@un33k
un33k / sed cheatsheet
Created August 22, 2011 13:28
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@un33k
un33k / profileit.py
Last active November 14, 2023 16:31
Performance Profile Decorator (function wrapper based on cProfile). Decorate any function to profile it.
import cProfile
def profileit(func):
"""
Decorator (function wrapper) that profiles a single function
@profileit()
def func1(...)
# do something
pass
@un33k
un33k / loto_robo.py
Created July 26, 2012 13:40
simple script to scrape (http://www.calottery.com) winning numbers and email it out.
# By Val Neekman (val@neekware.com)
import os, urllib2, sys, re, datetime, smtplib
## HOWTO:
# Change the following settings then run this script as "python loto_robo.py"
###### Settings ########
SEND_EMAIL = True
FROMADDR = "val@neekware.com"
$('#coverinner').on(
{
'focus': function(event) {
$(this).autocomplete({
minLength: 3,
source: function(req, res){
$.ajax({
url: 'https://maps.googleapis.com/maps/api/place/autocomplete/json',
data: {
input: req.term,
# https://code.djangoproject.com/ticket/17209
import urlparse
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.http import HttpResponseRedirect, QueryDict
from django.utils.decorators import method_decorator
from django.utils.http import base36_to_int
from django.utils.translation import ugettext as _
from django.views import generic
@un33k
un33k / nginx.conf
Last active January 17, 2023 22:36
Enable Nginx to send Content-Dispositions on specific files
server {
listen *:80;
server_name www.example.com;
rewrite ^(.*) http://example.com $1 permanent;
}
server {
listen *:80;
server_name example.com;
@un33k
un33k / screenflow_export_settings.txt
Created July 30, 2012 22:18
ScreenFlow Export Settings (HD)
# By Val Neekman [val@neekware.com
# Outsourcefactor.com
#
ScreenFlow Settings.
File -> Export
Preset = Web High
File -> Export -> Customize ->
@un33k
un33k / facebook-connect.py
Created October 12, 2011 15:19
code required to connect to Facebook in python / django
import urllib
from django.http import HttpResponseRedirect
from django.conf import settings
from django.contrib.auth import login as auth_login
from django.contrib.auth import authenticate
from django.core.urlresolvers import reverse
# Step 1. when facebook login is clicked, this function is hit
# Things to know: we have an app_id and app_secret from facebook for out app / site
@un33k
un33k / spleeter.md
Created January 7, 2022 19:32 — forked from dungsaga/spleeter.md
Voice removal AKA karaoke creator