Skip to content

Instantly share code, notes, and snippets.

@douglascabral
douglascabral / ports-in-use.sh
Created September 12, 2017 16:48
Ports in use
sudo netstat -tlpn | grep 8080
@douglascabral
douglascabral / dumpmysql.sh
Last active December 14, 2017 12:35
Dump MySQL Database to another one
mysqldump -h HOST_HERE -u USER_HERE -p'PASS_HERE' DATABASE_NAME_HERE | mysql -h ANOTHER_HOST_HERE \
-u ANOTHER_USER_HERE -p'ANOTHER_PASS_HERE' ANOTHER_DATABASE_NAME_HERE
@douglascabral
douglascabral / RecorderService.java
Created August 31, 2017 00:08 — forked from qihnus/RecorderService.java
a minimalist example of Android accessibility service
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
public class RecorderService extends AccessibilityService {
static final String TAG = "RecorderService";
private String getEventType(AccessibilityEvent event) {
@douglascabral
douglascabral / delete-files.sh
Created August 24, 2017 18:01
Delete matching files with pattern
find . -name \README.txt -type f -delete
@douglascabral
douglascabral / log-mysql.sql
Created July 31, 2017 13:37
Enable/disable mysql log
SET global general_log = 0; //Disable
SET global general_log = 1; //Enable
@douglascabral
douglascabral / remove-querystring.php
Created June 12, 2017 15:00
Remove querystring from url
$url = preg_replace('/\?.*/', '', $url);
SELECT JSON_EXTRACT(nome_do_campo_com_json, "$.nome_da_chave") FROM tbl
if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)) {
//is IE 11 or below
}
@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
@douglascabral
douglascabral / guid.rgx
Created December 1, 2016 14:20
REGEX para validar GUIDs
/([0-9A-Fa-f]{8})-([0-9A-Fa-f]{4}-){3}([0-9A-Fa-f]{12})/