Skip to content

Instantly share code, notes, and snippets.

@k1000
k1000 / securing_linux_server.md
Last active December 23, 2015 10:19
securing server

apt-get update

apt-get upgrade

apt-get install fail2ban

add user

useradd deploy

!#/usr/bin/python
import csv
from itertools import izip
f = open( '/django/sw2/wkw2/csvtest1.csv', 'r' )
reader = csv.reader( f )
keys = ( "firm_url", "firm_name", "first", "last", "school", "year_graduated" )
out = []
for property in reader:
data = [dict(zip(keys, property)) for property in reader]
@k1000
k1000 / ps5.sh
Created July 31, 2013 08:10
install photoshop5 in ubuntu
winetricks msxml6 gdiplus gecko vcrun2005sp1 vcrun2008 msxml3 atmlib
@k1000
k1000 / get_mixcloud_m4a.js
Last active December 20, 2015 06:58
Bookmarklet to download your favorite music from mixcloud
javascript: (function () {
var getElementByXpath = function (path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
};
var ele = document.getElementById('player-play');
var path = ele.getAttribute("data-preview-url").split("previews")[1].split(".")[0];
var download_path = "http://stream21.mixcloud.com/cloudcasts/m4a/64" + path + ".m4a";
var btn = document.createElement("a");
btn.setAttribute('target', "_new");
# mounts remote ssh directory
//xxx.xxx.xxx.xxx/F/ /mnt/new_server_f cifs username=xxxx,password=xxxx,uid=1000,gid=1000 0 0
@k1000
k1000 / tp_mp4.sh
Created July 19, 2013 09:42
Conversor de vídeos a mp4 (x264) con avconv
#!/bin/sh
#
# Conversor de vídeos a mp4 (x264) con avconv
# cargarme los log que puedan existir
rm *.log -f
rm *.mbtree -f
for ARCHIVO in *.MTS ;
do
@k1000
k1000 / play_sound_each_hour.sh
Last active December 19, 2015 21:18
Plays sound each hour
crontab -e
0 1 * * * aplay $HOME/Music/roadrunner2.wav
@k1000
k1000 / in_dv.sh
Last active July 25, 2016 09:29
Digestion and transcoding of DV trough firewire
#!/bin/bash
dev="DV1"
guid="0800460104f1381b"
format="avi"
f="$dev-`date +%Y-%m-%H.avi`"
echo "Processing $f file..."
# save as dv :demux=rawdv
# dvgrab --format dv2 -guid $guid - | vlc - --sout="#duplicate{dst=display,dst=standard{access=file,mux=avi,dst=\"$f\"})"
# 1to1 copy to mp4
avconv -i 00000.MTS -c:v copy -c:a copy file.mp4
def str2url(str):
"""
Takes a UTF-8 string and replaces all characters with the equivalent in 7-bit
ASCII. It returns a plain ASCII string usable in URLs.
"""
try:
str = str.encode('utf-8')
except:
pass
mfrom = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîï"