Skip to content

Instantly share code, notes, and snippets.

@LeonardoCardoso
LeonardoCardoso / DateConverterExtension.swift
Created July 4, 2016 12:50
Convert date from a format to another
extension String {
func convertDateDFormat(from: String = "yyyy-mm-dd", to: String = "EEE dd/mm/yyyy") -> String! {
let dateOriginalFormat = NSDateFormatter()
dateOriginalFormat.dateFormat = from
let dateDestinationFormat = NSDateFormatter()
dateDestinationFormat.dateFormat = to
#!/usr/bin/env bash
PRODUCTS_PATH=$1
PROJECT_NAME=$2
VERSION=$3
if (( $# != 3 )); then
echo "Wrong usage. Please pass the correct arguments.
>> ./bind-frameworks PRODUCTS_PATH PROJECT_NAME VERSION"
else
@LeonardoCardoso
LeonardoCardoso / update_version.sh
Created May 14, 2018 09:46
Update version on your project using a single command
function updateversion() {
OLD="$1"
NEW="$2"
grep -rl "$OLD" . --exclude-dir={"Build","libs","Pods",".git"} --exclude={"Podfile.lock","CHANGELOG.md","update-version.sh"} | xargs sed -i.bak "s/$OLD/$NEW/g";
find . -type f -name '*.bak' -delete
}
@LeonardoCardoso
LeonardoCardoso / andaction.sh
Last active October 30, 2018 09:56
AndAction - Script to Generate a Nice Folder Structure for Cinematography Projects
#!/bin/bash
### Functions
trim() {
local trimmed="$1"
# Strip leading space.
trimmed="${trimmed## }"
# Strip trailing space.
trimmed="${trimmed%% }"
@LeonardoCardoso
LeonardoCardoso / checkBitrate.sh
Last active October 30, 2018 09:56
Check Bitrate by afinfo
for i in **/*.mp3; do afinfo "$i" |grep "bit rate" ; done
@LeonardoCardoso
LeonardoCardoso / bitrateUp.sh
Last active October 30, 2018 09:56
Increate bitrate by ffmpeg
for f in *; do
if [[ -d $f ]]; then
cd $f
for i in **/*.mp3; do ffmpeg -i "$i" -codec:a libmp3lame -b:a 192k "0-$i" ; done
cd ../
else
for i in **/*.mp3; do ffmpeg -i "$i" -codec:a libmp3lame -b:a 192k "0-$i" ; done
fi
done
@LeonardoCardoso
LeonardoCardoso / README.md
Last active October 30, 2018 09:56
RXMVVM Shell function

Usage

$ rxmvvm "AddressList" "LightPass" "Leonardo Cardoso" "1aim.com" .

  • $1 = Name of File
  • $2 = Name of Project
  • $3 = Name of Author
  • $4 = Website
  • $5 = Path
@LeonardoCardoso
LeonardoCardoso / GitHubDark.css
Created February 9, 2017 12:48
MacDown GitHubDark Theme
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote {
margin: 0;
padding: 0;
@LeonardoCardoso
LeonardoCardoso / combinations.py
Created November 29, 2016 12:30
Generate all combinations of a string, uppercase and lowercase.
def recurse (pref,suff):
# If no characters left, just print prefix.
if suff == "":
print pref
return
# Otherwise add lowercase of first suffix letter to prefix
# and recur with that and the remainder of the suffix.
# Then do the same for uppercase.
@LeonardoCardoso
LeonardoCardoso / change-screen-shot-location.sh
Created August 31, 2016 13:53
Change Screen Shot location on Mac
defaults write com.apple.screencapture location ~/PATH_YOU_WANT; killall SystemUIServer