Skip to content

Instantly share code, notes, and snippets.

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

Jose josellausas

🏠
Working from home
View GitHub Profile
@josellausas
josellausas / install_ruby_rpi.sh
Created May 23, 2017 05:40 — forked from blacktm/install_ruby_rpi.sh
A Bash script to install Ruby 2.4 on the Raspberry Pi (Raspbian)
#!/bin/bash
# --------------------------------------------------------------------------------------------
# Installs Ruby 2.4 using rbenv/ruby-build on the Raspberry Pi (Raspbian)
#
# Run from the web:
# bash <(curl -s https://gist.githubusercontent.com/blacktm/8302741/raw/install_ruby_rpi.sh)
# --------------------------------------------------------------------------------------------
# Welcome message
@josellausas
josellausas / install_openvpn.sh
Created May 23, 2017 05:53
Install VPN on raspberry pi
sudo apt-get install openvpn
# Copy over the .tar.gz with the config files
sudo mv $$$$_linux.tar.gz /etc/openvpn
cd /etc/openvpn
sudo tar -xf $$$$_linux.tar.gz
# Enable up/down
sudo chmod +x /etc/openvpn/update-resolv-conf
# Use this to start:
@import url('https://fonts.googleapis.com/css?family=Lato');
* {
box-sizing: border-box; // Prevent borders from being larger thanks to padding and margins.
}
body {
line-height: 1.6;
color: #3a3a3a;
@josellausas
josellausas / start.html
Created June 16, 2017 02:50
Started django html template.
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
{# <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.4.1/css/bulma.min.css">#}
<link rel="stylesheet" href="{% static 'normalize.css' %}">
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
@josellausas
josellausas / django_slug_save.py
Created January 7, 2018 08:09
Django Save function for slugs
def save(self, *args, **kwargs):
if not self.slug:
# Ensure uniqueness:
slug = slugify(self.name)
if not App.objects.filter(slug=slug).exists():
self.slug = slug
else:
count = 1
while App.objects.filter(slug=slug).exists():
count += 1
@josellausas
josellausas / setup_composer.sh
Last active March 1, 2018 15:30
Setup Mapstory story-tools-composer for development.
#!/usr/bin/env bash
rm -fr story-tools
rm -fr story-tools-composer
git clone https://github.com/MapStory/story-tools
git clone https://github.com/MapStory/story-tools-composer
# Setup story-tools
cd story-tools && \
git checkout composer && \
yarn install && \
@josellausas
josellausas / cert_gen.sh
Last active February 19, 2018 19:53
Crete some certs
mkdir /etc/nginx/ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
@josellausas
josellausas / csv_download.js
Created March 8, 2018 16:33
Javascript: Download as CSV
const downloadCSV = csv_data => {
const hidden_element = document.createElement("a");
const uri_encoded = encodeURI(csv_data);
hidden_element.href = `data:text/csv;charset=utf8,${uri_encoded}`;
hidden_element.target = "_blank";
hidden_element.download = "storypins.csv";
hidden_element.click();
};
do shell script "~/some_script.py"