Skip to content

Instantly share code, notes, and snippets.

@douglascabral
douglascabral / ImageToBase64.swift
Created November 22, 2018 20:40
Transform UIImage to Base64
// drawnImage : UIImage
let imgData = drawnImage.jpegData(compressionQuality: 1.0)
let base64 = imgData?.base64EncodedString()
@douglascabral
douglascabral / ImageRotate.swif
Created November 22, 2018 20:26
Rotate UIImage
import UIKit
extension UIImage {
public func imageRotatedByDegrees(degrees: CGFloat, flip: Bool) -> UIImage {
let radiansToDegrees: (CGFloat) -> CGFloat = {
return $0 * (180.0 / CGFloat.pi)
}
let degreesToRadians: (CGFloat) -> CGFloat = {
return $0 / 180.0 * CGFloat.pi
for SERIAL in $(adb devices | grep -v List | cut -f 1); do adb -s $SERIAL install -r nome-do-arquivo-do-app.apk; done
<?php
header('Content-Type: application/json');
$body = file_get_contents("php://input");
$bodyjson = json_decode($body);
$number1 = $bodyjson->queryResult->parameters->number1;
$number2 = $bodyjson->queryResult->parameters->number2;
$action = $bodyjson->queryResult->action;
$result = 0;
@douglascabral
douglascabral / kong
Last active July 30, 2018 20:20
Kong init.d
#!/bin/sh
#
# chkconfig: - 80 45
# description: Starts and stops Kong
# Enable: http://manpages.ubuntu.com/manpages/zesty/man8/update-rc.d.8.html
# update deamon path to point to the kong executable
start() {
echo -n "Starting Kong... "
kong start
find . -type f -size +512M -exec ls -lh {} \;
echo "FRASE" | tr 'A-Z' 'a-z'
sudo du -hsx * | sort -rh | head -10
mysqldump database_name_1 \
--host=address_1 \
--port=3306 \
--user=username_1 \
--password=password_1 \
--single-transaction \
--compress \
--no-create-db \
--skip-add-locks \
--skip-comments | mysql \
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';