Skip to content

Instantly share code, notes, and snippets.

View jlopezcur's full-sized avatar
🏠
Working from home

Javier jlopezcur

🏠
Working from home
View GitHub Profile
@jlopezcur
jlopezcur / commands.sh
Last active April 1, 2019 23:31
Optimize images
# The tools
sudo apt install libjpeg-progs optipng
# Compress jpg
jpegtran -copy none -optimize -perfect -outfile output.jpg input.jpg
# Compress png
optipng -o7 *.png
@jlopezcur
jlopezcur / setup.sh
Last active July 13, 2017 01:29
Setup Laravel Server
# Packages
sudo apt install php7.0 php7.0-mbstring php7.0-xml php7.0-mysql php7.0-cli git curl composer nginx mariadb-client -y
# Deployment user
sudo adduser forge --disabled-password
sudo adduser forge sudo
# Certbot (Let's encrypt)
sudo apt update
sudo apt install software-properties-common
@jlopezcur
jlopezcur / permissions.sh
Last active May 25, 2017 09:36
Python staff
sudo adduser [user] staff
# Star Wars in ASCII
telnet towel.blinkenlights.nl
@jlopezcur
jlopezcur / 01_Shell.sh
Last active July 15, 2018 12:21
Basic Setup
# Powerline fonts (https://github.com/powerline/fonts)
wget https://github.com/Lokaltog/powerline/raw/develop/font/PowerlineSymbols.otf https://github.com/Lokaltog/powerline/raw/develop/font/10-powerline-symbols.conf
sudo mv PowerlineSymbols.otf /usr/share/fonts/
sudo fc-cache -vf
sudo mv 10-powerline-symbols.conf /etc/fonts/conf.d/
# Fish
sudo apt install fish -y
curl -L https://get.oh-my.fish | fish
cat > ~/.config/fish/config.fish <<'endmsg'
@jlopezcur
jlopezcur / navbar.html
Created September 20, 2016 22:41
Bootstrap 4 Navbar
<nav class="navbar navbar-fixed-top navbar-dark bg-primary">
<a class="navbar-brand" href="#">Title</a>
<button class="navbar-toggler hidden-sm-up pull-xs-right" type="button" data-toggle="collapse" data-target="#collapsingNavbar" aria-controls="collapsingNavbar" aria-expanded="false" aria-label="Toggle navigation">
&#9776;
</button>
<div class="hidden-sm-up" style="margin-top:38px;"></div>
@jlopezcur
jlopezcur / .htaccess
Last active December 16, 2015 10:19
Laravel 5 on subdir (moving public content to project root)
# File: /.htaccess (After move public content to root)
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
@jlopezcur
jlopezcur / countries.json
Last active August 29, 2015 14:28 — forked from keeguon/countries.json
A list of countries in JSON
[
{"name": "Afghanistan", "code": "AF"},
{"name": "Åland Islands", "code": "AX"},
{"name": "Albania", "code": "AL"},
{"name": "Algeria", "code": "DZ"},
{"name": "American Samoa", "code": "AS"},
{"name": "AndorrA", "code": "AD"},
{"name": "Angola", "code": "AO"},
{"name": "Anguilla", "code": "AI"},
{"name": "Antarctica", "code": "AQ"},
@jlopezcur
jlopezcur / DB Backup From PHP
Created November 2, 2014 17:18
Based on http://davidwalsh.name/backup-mysql-database-php but updated :) and using a stored connection of MySQLi.
function adminBackupTables($tables = '*') {
global $mysqli;
//get all of the tables
if($tables == '*') {
$tables = array();
$result = $mysqli->query('SHOW TABLES');
while($row = $result->fetch_row($result)) {
$tables[] = $row[0];
}
var SITE = SITE || {};
SITE.fileInputs = function() {
var $this = $(this),
$val = $this.val(),
valArray = $val.split('\\'),
newVal = valArray[valArray.length-1],
$button = $this.siblings('.button'),
$fakeFile = $this.siblings('.file-holder');
if(newVal !== '') {