Skip to content

Instantly share code, notes, and snippets.

View 5a494d's full-sized avatar
🌴
On vacation

5a494d 5a494d

🌴
On vacation
View GitHub Profile
@5a494d
5a494d / clean-raspbian.sh
Last active November 11, 2015 05:05
raspbian config
#!/usr/bin/bash
# dpkg -l : Lista todos los paquetes instalados en el sistema.
# grep -i -e : Filtra los paquetes (grep) ignorando si son mayúsculas o minúsculas (-i) en base a un patrón (-e).
# awk ‘{print $2}’ : Mostramos sólo la segunda columna.
# > paquetes.txt : Redirigimos la salida al archivo de texto paquetes.txt.
dpkg -l | grep -i -e LXDE -e X11 -e "xserver" -e desktop -e gtk -e alsa | awk '{print $2}' > paquetes.txt
sudo apt-get remove $(cat paquetes.txt)
@5a494d
5a494d / install-qgis.sh
Last active November 11, 2015 05:26
qgis - config
#!/usr/bin/bash
# Shell para la instalacion de qgis junto con el servidor
# Load public keys for qgis repository
sudo gpg --recv-key DD45F6C3
sudo gpg --export --armor DD45F6C3 | sudo apt-key add -
# upgrade system packages
@5a494d
5a494d / install-java-8.sh
Created October 1, 2016 23:52
install-java-8.sh
#!/bin/bash
# ø
# Run this script as root
# Installs Java here: /usr/lib/jvm/java-8-oracle
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get -y install oracle-java8-installer
java -version
@5a494d
5a494d / install-docker-x64.sh
Last active October 2, 2016 00:36
install-docker.sh
#!/bin/bash
# Run this script as root
# Build for debian jessie (tested in 8.6)
# source: https://docs.docker.com/engine/installation/linux/debian/#/debian-jessie-80-64-bit
apt-get purge -y "lxc-docker*"
apt-get purge -y "docker.io*"
apt-get update
apt-get install -y apt-transport-https ca-certificates
@5a494d
5a494d / .htaccess
Created October 26, 2016 17:06
Laravel - Force ssl
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
!#/bin/bash
git remote add origin https://github.com/yourname/my_project.git
git pull origin master
git add --all
git commit -m "[UPDATE] conflictive files"
git push origin master
@5a494d
5a494d / array_to_object.php
Created January 14, 2017 00:48
Convert array to php
<?php
# Simple loop copy - not recursive
function loop_copy($array) {
$object = new stdClass();
foreach ($array as $key => $value) {
$object->$key = $value;
}
}
@5a494d
5a494d / left_join_with_mysql_view.sql
Last active February 10, 2017 19:11
multiple clauses with mysql
SELECT
T0.client_id, name, exts, vms, ivrs, queues, conf10, conf20, conf30
FROM
vw_clients T0
left join vw_exts T1 on T0.client_Id=T1.client_id
Left join vw_vms T2 on ...
...
Where ...
@5a494d
5a494d / AdvancedNewFile.sublime-settings
Created September 16, 2017 19:13
Default(Linux).sublime-personal
{
"rename_default": "<filepath>"
}
@5a494d
5a494d / escace.js
Created October 2, 2017 19:32
Escape Characters
var source = '\x53\x6f\x72\x72\x79\x21\x20You\x72 \x6be\x79\x20\x66\x69l\x65\x20\x69s i\x6eva\x6ci\x64\x2e';
var decoded = source.replace(/\\x([a-f0-9][a-f0-9])/g, function(a,b) {
return String.fromCharCode(parseInt(b, 16));
});
document.write(decoded);