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 / instructions.txt
Created April 26, 2020 00:09 — forked from nathanborror/instructions.txt
Example Kubernetes setup with Postgres and two Services for serving an API and a static site using Ingress. Also have a CronJob example for kicks.
*** Cluster Setup for Google Container Engine ***
0/ Install and configure local gcloud and kubectl: https://cloud.google.com/sdk/docs/
> gcloud components install kubectl
1/ Configure Google Cloud account:
> gcloud config set account YOUR_EMAIL_ADDRESS
> gcloud config set project YOUR_PROJECT_ID
> gcloud config set compute/zone us-west1-a
> gcloud config set container/cluster example
import os.path
import pandas as pd
from bokeh.core.properties import value
from bokeh.io import show, output_file, output_notebook
from bokeh.plotting import figure
output_notebook()
def plot_state_incidents(data):
year_names = [str(x) for x in data['year'].values.tolist()]
years = year_names
do shell script "~/some_script.py"
@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();
};
@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 / 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 / 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
/*! 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 / 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' %}">
@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;