Skip to content

Instantly share code, notes, and snippets.

View williameliel's full-sized avatar
💭
annoying-a

William Garcia williameliel

💭
annoying-a
View GitHub Profile
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require("webpack");
module.exports = {
entry: "./src/index.js",
mode: "development",
target: "web",
devServer: {
historyApiFallback: true,
},
@williameliel
williameliel / gist:87c3b8bb79c4cd3e3ac21f79b299504a
Last active February 1, 2017 16:05
Translate Languages / Codes
af Afrikaans
sq Albanian
ar Arabic
az Azerbaijani
eu Basque
bn Bengali
be Belarusian
bg Bulgarian
ca Catalan
zh-CN Chinese Simplified
@williameliel
williameliel / .htaccess
Created January 19, 2017 16:48
Password-protect wp-admin/.htaccess
AuthType Basic
AuthName "WordPress Protected Area"
AuthUserFile /path/to/admin/passwords
Require valid-user
<Files admin-ajax.php>
Order allow,deny
Allow from all
Satisfy any
</Files>
<Files "\.(css|gif|png|js)$">
@williameliel
williameliel / gist:3f6a22f5d95a7b4822d0aa4063dd01f3
Created July 6, 2016 15:49
Mount a disk in ubuntu (AWS EBS)
[ec2-user ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvdf 202:80 0 100G 0 disk
xvda1 202:1 0 8G 0 disk /
The output of lsblk removes the /dev/ prefix from full device paths. In this example, /dev/xvda1 is mounted as the root device (note the MOUNTPOINT is listed as /, the root of the Linux file system hierarchy), and /dev/xvdf is attached, but it has not been mounted yet.
Determine whether you need to create a file system on the volume. New volumes are raw block devices, and you need to create a file system on them before you can mount and use them. Volumes that have been restored from snapshots likely have a file system on them already; if you create a new file system on top of an existing file system, the operation overwrites your data. Use the sudo file -s device command to list special information, such as file system type.
[ec2-user ~]$ sudo file -s /dev/xvdf
/dev/xvdf: data
@williameliel
williameliel / vscode
Created June 8, 2016 14:40
Add Visual Studio Code to Command line with a Folder as params...
#in ~/bin create a file called vscode and give it execute permissions and copy the following:
#!/bin/bash
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
[[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
open -a "Visual Studio Code" --args "$F"
fi
@williameliel
williameliel / s3 migration
Last active April 7, 2017 20:05
Use this with the delicious brains S3 offset plugin. Will create the metadata for all the assets in the Wordpress site
<?php
include('wp/wp-load.php');
class S3{
private $bucket = 'bucket-cdn';
private $directories = 'content/uploads/';
private $sites = '';
private $post_id = null;
<?php
/* Get instagram User ID */
function get_instagram_id($username) {
$user_id = false;
if (!isset($username)) return false;
$username = str_replace('@', '', $username);
$access_token = '14319814.b082a92.c96b36393e574726ad08491ea64731ed';
$url = "https://api.instagram.com/v1/users/search?q=" . $username . "&access_token=" . $access_token;
@williameliel
williameliel / install-redis.sh
Created May 23, 2016 00:47 — forked from dstroot/install-redis.sh
Install Redis on Amazon EC2 AMI
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@williameliel
williameliel / gist:ce5131182f7c3b9d918a
Created March 22, 2016 16:01
Add IP to apache log -varnish
default_vcl add to vcl_recv func
if (req.restarts == 0) {
if (req.http.X-Forwarded-For) {
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;
}
}
@williameliel
williameliel / export.sh
Created December 14, 2015 17:53
Export all MYSQL Databases individual files
#!/bin/bash
USER="zend"
PASSWORD=""
#OUTPUT="/Users/rabino/DBs"
#rm "$OUTPUTDIR/*gz" > /dev/null 2>&1
databases=`mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`