Skip to content

Instantly share code, notes, and snippets.

@epety
epety / target_blank.js
Created June 27, 2016 15:08 — forked from allybee/target_blank.js
Add target="_blank" to external links with pure JavaScript.
function targetBlank() {
// remove subdomain of current site's url and setup regex
var internal = location.host.replace("www.", "");
internal = new RegExp(internal, "i");
var a = document.getElementsByTagName('a'); // then, grab every link on the page
for (var i = 0; i < a.length; i++) {
var href = a[i].host; // set the host of each link
if( !internal.test(href) ) { // make sure the href doesn't contain current site's host
a[i].setAttribute('target', '_blank'); // if it doesn't, set attributes
@epety
epety / node-install.sh
Last active June 13, 2016 16:50
Nodejs installation script
#!/bin/bash
echo "Node Linux Installer by www.github.com/taaem"
if [[ $EUID -ne 0 ]]; then
echo "Need Root for installing NodeJS"
sudo sh -c 'echo "Got Root!"'
else
echo "Running as Root User"
fi
# sets the proxy cache path location, max size 2g
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
# transfers the `Host` header to the backend
proxy_set_header Host $host;
# uses the defined STATIC cache zone
proxy_cache STATIC;
# cache 200 10 minutes, 404 1 minute, others status codes not cached
@epety
epety / imgur-uploader
Created May 6, 2016 16:07 — forked from codecat/imgur-uploader
xfce4-screenshooter to imgur
#!/bin/bash
# Ubuntu Keyboard settings shortcut:
# xfce4-screenshooter -r -o "sh /location/to/imgur-uploader.sh"
API_KEY=YOUR_API_KEY_GOES_HERE
URL=http://api.imgur.com/2/upload
RESPONSE=$(curl -s -F "key=$API_KEY" -F "image=@$1" $URL)
echo "$RESPONSE" | grep -o -E "<original>.*</original>" | grep -o -E "http://.*\.png" | xsel -i -b
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@epety
epety / mysqldumpall.sh
Last active August 29, 2015 14:02 — forked from tonybolzan/mysqldumpall.sh
Mysql Backup
#!/bin/bash
# MySQL Dump All
#
# Backup (mysqldump) all your MySQL databases in separate files
#
# Author Tonin R. Bolzan <[email protected]>
# License http://www.opensource.org/licenses/mit-license.php MIT License
# https://gist.github.com/tonybolzan
<div class="the-return">
[HTML is replaced when successful.]
</div>
<!-- Open Graph tags for your home page (index). -->
<meta property="og:site_name" content="{Title}" />
<meta property="fb:app_id" content="FACEBOOK_APPID"/>
<meta property="fb:admins" content="FACEBOOK_USERID" />
<meta property="og:description" content="{MetaDescription}" />
<meta property="og:locale" content="en_US" />
{block:IndexPage}
<meta property="og:image" content="{PortraitURL-128}" />
<meta property="og:title" content="{Title}" />