# This give you the last day of the month given on second index
from calendar import monthrange
monthrange(2012, 2)
>>> (2, 29)
import datetime
# This give you the last day of the month given on second index
from calendar import monthrange
monthrange(2012, 2)
>>> (2, 29)
import datetime
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl" |
# -*- mode: django -*- | |
# vi: set ft=python : | |
# Module to know the host platform | |
# Based on BernardoSilva's answer in http://stackoverflow.com/questions/26811089/vagrant-how-to-have-host-platform-specific-provisioning-steps | |
module OS | |
def OS.mac? | |
(/darwin/ =~ RUBY_PLATFORM) != nil | |
end | |
def OS.linux? |
#!/usr/bin/env bash | |
if [ -d "./chuko" ]; then | |
echo "WOlolo" | |
else | |
echo "wtf!?" | |
fi |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
diskutil list | |
diskutil partitionDisk /dev/disk1 1 "Free Space" "unused" "100%" | |
sudo dd bs=1m of=/dev/rdisk1 if=manjaro-kde-17.0-stable-x86_64.iso |
''' Method to connect to a database url(URI) with psycopg2 ''' | |
import os | |
import psycopg2 | |
import urlparse # import urllib.parse for python 3 | |
result = urlparse.urlparse(os.environ["DATABASE_URL"]) | |
username = result.username | |
password = result.password | |
database = result.path[1:] |
''' | |
Script for join CSV | |
author: @xtornaso5l2 | |
''' | |
import os | |
files = os.listdir(os.curdir) | |
# ['.DS_Store', 'download (1).csv', 'download (2).csv', 'download.csv'] | |
files.remove('.DS_Store') # Only for mac | |
# ['download (1).csv', 'download (2).csv'] |
// _GAZeb Id de Cliente | |
// _GAvi Parent Element (days) | |
// _GAOyb Fecha (date) | |
// _GAMI Hora (hour) | |
// Script to retrieve data from | |
// Create Data Sessions for clients | |
console.clear(); | |
var sessions_client = [] | |
// Get client ID |
''' Convert any file to base64 using base64 python standard library ''' | |
import base64 | |
with open('MyFile.ext', 'rb') as f: | |
# read file as binary and encode to base64 | |
encoded_string = base64.b64encode(f.read()) | |
with open('cer.base64', 'w') as f: | |
# write in a new file the base64 | |
f.write(encoded_string) |