Skip to content

Instantly share code, notes, and snippets.

View dansku's full-sized avatar
🌮
Focusing on tacos

Daniel Andrade dansku

🌮
Focusing on tacos
View GitHub Profile
@dansku
dansku / addDomain.py
Created September 27, 2013 15:40
Add new domain to nginx, then you need to restart nginx!
import sys
import os
print "Create New Domain!"
dom = raw_input("DomainName: ")
print "Creating domain", dom
print "Creating folder /var/www/" + dom + '/html'
@dansku
dansku / thumbs.py
Created November 16, 2013 22:19
fixing pictures for website
import os, time
import glob
#Define Pictures Folder
folder = '/path/'
pics = glob.glob(folder+"*.jpg")
#Get Folder Char Number
x = folder.count("")
@dansku
dansku / clearCache.sh
Created December 4, 2013 20:36
Script to clear cache
#!/bin/sh
sync; echo 3 > /proc/sys/vm/drop_caches
@dansku
dansku / picResize.sh
Last active August 29, 2015 13:56
Picture Resize, create original, smaller and thumbs to be used on a jekyll blog
#!/bin/bash
#-------------------------------------------------------
# Daniel Spillere Andrade - www.danielandrade.net
# Script to Create Images for websites
#-------------------------------------------------------
#-- VARIABLES --#
BIG=960000
@dansku
dansku / dropboxOrganize.py
Created February 16, 2014 20:32
Script to organize pictures uploaded from Mobile Devices to Dropbox's Camera Upload folder
################################################################################################
#
# Script to organize pictures uploaded from Mobile Devices to Dropbox's Camera Upload folder
#
# Daniel Spillere Andrade - www.danielandrade.net
#
################################################################################################
import os, time
import glob
@dansku
dansku / listComPorts.py
Last active August 29, 2015 13:56
script to list com/serial ports
import serial
import time
import _winreg as winreg
import itertools
import datetime
def enumerate_serial_ports():
""" Uses the Win32 registry to return an
iterator of serial (COM) ports
existing on this computer.
@dansku
dansku / LinuxTerminal.sh
Last active August 29, 2015 13:57
Schell command to convert Flac files to Mp3 in all Subdirectories and Remove Flac Files when Done.
Recursively remove .* files
find . -name ._\* -print0 | xargs -0 rm -f
individual folder:
for f in *.flac; do ffmpeg -i "$f" -ab 320k "${f%.flac}.mp3" && rm "$f"; done
find . -type f -name "*.flac" -exec bash -c 'for f; do ffmpeg -i "$f" -ab 320k "${f%.flac}.mp3" && rm "$f"; done' _ {} +
for i in */*/*.flac; do ffmpeg -i "$i" -ab 320k "${i%.flac}.mp3" && rm "$i"; done
#Python Parser
import os
import sys
import re
#-----[ Config ]-------------------------------------
baseFile = 'base_main_Rate8.cfg'
@dansku
dansku / decriptTemp.py
Created March 11, 2014 21:51
decript function in python
#Install on windows http://apprenticealf.wordpress.com/2011/01/14/windows-python-ebooks-and-drm/
from Crypto.Cipher import AES
import base64
AES.key_size=128
iv="12345678abcdefgh"
key="12345678abcdefgh12345678abcdefgh"
crypt_object=AES.new(key=key,mode=AES.MODE_CBC,IV=iv)
@dansku
dansku / magento_change_price.sql
Created March 31, 2014 18:47
Bulk price change for magento
update catalog_product_entity_decimal
set value = value*1.2
where attribute_id = 75 and
entity_id IN (select product_id from catalog_category_product
where category_id = X);