Skip to content

Instantly share code, notes, and snippets.

Junio Vitorino juniovitorino

View GitHub Profile
View index.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JS Module in Browser</title>
<script type="module" src="./js/main.js"></script>
</head>
<body></body>
</html>
@juniovitorino
juniovitorino / ncenter
Created Nov 12, 2013
Load/Unload OS X Notification Center
View ncenter
# Notification Center
alias ncstop="launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist"
alias ncstart="launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist"
@juniovitorino
juniovitorino / init.sh
Created Jun 29, 2016 — forked from tmiller/init.sh
DigitalOcean ubuntu 14.04 server configuration script.
View init.sh
#!/bin/bash
username="ubuntu"
ssh_pub_key=""
# Setup user
adduser $username
usermod -a -G sudo $username
sudo mkdir -p "/home/${username}/.ssh"
sudo echo "${ssh_pub_key}" > "/home/${username}/.ssh/authorized_keys"
View AppLock.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDescription</key>
<string>Disables the home button.</string>
<key>PayloadDisplayName</key>
View Procfile
web: /usr/local/sbin/nginx -p `pwd`/tmp/nginx/ -c ../../nginx.conf
fastcgi: /usr/local/sbin/php-fpm
db: /usr/local/bin/mysqld
@juniovitorino
juniovitorino / toEM.sass
Last active Dec 19, 2015
SASS Function to convert PX in EM
View toEM.sass
$em-base: 16px !default;
@function toEM($px) {
@return $px / $em-base * 1em;
}
@juniovitorino
juniovitorino / remove-extension.conf
Created Jun 28, 2013
Remove file extension from urls's
View remove-extension.conf
# http://www.niallflynn.com/seo-news/remove-file-extension-from-urls/
<IfModule mod_rewrite.c>
AddType text/x-component .htc
RewriteEngine On
RewriteBase /
# remove .php; use THE_REQUEST to prevent infinite loops
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
RewriteRule (.*)\.php$ $1 [R=301]
# remove index
@juniovitorino
juniovitorino / ievm.zsh
Last active Dec 18, 2015
ZSH Function to download and install Windows and Internet Explorer VirtualBox VM from xdissent ievms project.
View ievm.zsh
function ievm {
curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | env IEVMS_VERSIONS="$1" bash
}
@juniovitorino
juniovitorino / xss_sanitization.php
Last active Dec 17, 2015
WordPress Recursive XSS Sanitization
View xss_sanitization.php
// XSS HTTP Treatment
add_filter('init', 'xssTreatment');
function xssTreatment() {
foreach(array($_GET, $_POST, $_REQUEST) as $httpConst) XSSSanitization( $httpConst );
}
function XSSSanitization(&$param) {
if(!is_array( $param ) && is_string( $param ) ) $param = filter_var($param, FILTER_SANITIZE_STRING);
@juniovitorino
juniovitorino / gist:5587839
Created May 15, 2013
Hotlink Protection
View gist:5587839
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?youralloweddomain.com [NC]
RewriteRule \.(jpeg|jpg|gif|pdf)$ - [NC,F,L]
</IfModule>
You can’t perform that action at this time.