Skip to content

Instantly share code, notes, and snippets.

Douglas Cabral douglascabral

Block or report user

Report or block douglascabral

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View generate-qrcode-from-csv.sh
for line in `cat file.csv | sed -e 's/\r//g'`; do qrencode -o ${line}.png -s 10 ${line}; done
@douglascabral
douglascabral / ImageToBase64.swift
Created Nov 22, 2018
Transform UIImage to Base64
View ImageToBase64.swift
// drawnImage : UIImage
let imgData = drawnImage.jpegData(compressionQuality: 1.0)
let base64 = imgData?.base64EncodedString()
View ImageRotate.swif
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
View install-apks-multiple-devices.sh
for SERIAL in $(adb devices | grep -v List | cut -f 1); do adb -s $SERIAL install -r nome-do-arquivo-do-app.apk; done
View dialogflow-api-integration.php
<?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;
View biggest-files.sh
find . -type f -size +512M -exec ls -lh {} \;
@douglascabral
douglascabral / .htaccess
Created Apr 18, 2018
Parâmetros de segurança para o Apache
View .htaccess
#bloqueia o acesso ao git
RedirectMatch 404 /\\.git(/|$)
#bloqueia o acesso em arquivos e pastas ocultas
RedirectMatch 404 (?i)/\..+
#não permite listagem de pastas sem index
Options -Indexes
View clone-db-mysql.sh
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 \
You can’t perform that action at this time.