Skip to content

Instantly share code, notes, and snippets.

View mateuslopes's full-sized avatar

Mateus Lopes mateuslopes

View GitHub Profile
@mateuslopes
mateuslopes / wp-empty-widget.php
Created June 22, 2012 04:34 — forked from jonathonbyrdziak/CustomWidgetFile.php
Wordpress+Widget: EMPTY WIDGET Plugin code to create a single widget in wordpress.
<?php
/**
* @package RedRokk
* @version 1.0.0
*
* Plugin Name: Empty Widget
* Description: Single Widget Class handles all of the widget responsibility, all that you need to do is create the html. Just use Find/Replace on the Contact_RedRokk_Widget keyword to rebrand this class for your needs.
* Author: RedRokk Interactive Media
* Version: 1.0.0
* Author URI: http://www.redrokk.com
@mateuslopes
mateuslopes / backyp-mysql-db.sh
Created December 3, 2015 17:04
ShellScript: Backup MySQL Database
#!/bin/sh
NOW=$(date +"%F")
sh -c "mysqldump -u <UserName> -p<Password> <DatabaseName> | gzip -9 > <DatabaseName>-$NOW.sql.gz"
echo "MYSQL DATABASE BACKUP GENERATED AT $NOW"
@mateuslopes
mateuslopes / goo.sh
Created December 3, 2015 17:22
ShellScript: Open Google
#!/bin/sh
url="https://www.google.com.br/?q=$1"
open "$url"
@mateuslopes
mateuslopes / clear-linux-memory-cache.sh
Created December 3, 2015 17:30
ShellScript: Clear linux cache memory
#!/bin/sh
# http://www.unixmen.com/how-to-clear-memory-cache-on-linux-servers/
NOW=$(date +"%F %T")
sh -c "free -mt >> /root/drop_caches.log"
echo "$NOW" >> /root/drop_caches.log
echo "--------------------" >> /root/drop_caches.log
sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
@mateuslopes
mateuslopes / apache2-block-git-folders-access.conf
Created September 28, 2020 17:11
Block access .git folders and files on Apache2 servers
# Put this into your httpd.conf to block access to any server .git folders and files
<DirectoryMatch "^/.*/\.git+/">
Order deny,allow
Deny from all
</DirectoryMatch>
<Files ~ "^\.git">
Order allow,deny
Deny from all
</Files>
@mateuslopes
mateuslopes / numerology.php
Created May 14, 2021 22:13
PHP Numerology Calculator
<?php
class NumerologyCalc {
const BASE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const VALID_FINAL_NUMBERS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44];
public $numerology = null;
function __construct($input = "", $show = false) {