Skip to content

Instantly share code, notes, and snippets.

View jesusalber1's full-sized avatar
👨‍💻

Jesús Alberto Polo García jesusalber1

👨‍💻
View GitHub Profile
@jesusalber1
jesusalber1 / ghost
Created November 20, 2016 21:46
Ghost nginx configuration
# sets the proxy cache path location, max size 512m
proxy_cache_path /var/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=512m;
# transfers the `Host` header to the backend
proxy_set_header Host $host;
# uses the defined STATIC cache zone
proxy_cache STATIC;
# cache 200 10 minutes, 404 1 minute, others status codes not cached
@jesusalber1
jesusalber1 / Manager.gs
Last active November 23, 2016 12:53
Calendar synchronization: EDT (Telecom Bretagne) and GCal
/* Constants */
var URL_EDT = 'http://edt.telecom-bretagne.eu/xxx'; /* Student's iCal source (EDT) */
var GCAL_ID = 'xxx@group.calendar.google.com'; /* Google Calendar ID */
/* ---Helpers--- */
/* Custom object to handle events between EDT and GCal */
function CustomEvent(title, startTime, endTime, description, location) {
this.title = title;
this.startTime = startTime;
this.endTime = endTime;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Fil Rouge</title>
<link href="https://netdna.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<link rel="stylesheet" href="assets/style.css">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
@jesusalber1
jesusalber1 / nodeclick.js
Created May 31, 2018 20:02
neo4jd3 onNodeClick example
var neo4jd3 = new Neo4jd3('#neo4jd3', {
onNodeClick: function(node) {
if (node.id == 5) { // your node id
$.ajax({
url: "/endpoint", // your API endpoint
dataType: 'json', // if you receive a JSON
success: function(data) {
neo4jd3.updateWithNeo4jData(data);
}
});
@jesusalber1
jesusalber1 / pi.py
Created February 26, 2019 22:00
Estimating Pi using the Monte Carlo method
import random
import math
inner = 0
total = 0
for i in range(10000):
x = random.random()
y = random.random()
if (math.sqrt(x**2 + y**2) < 1):
@jesusalber1
jesusalber1 / open_url.py
Last active March 11, 2019 22:46
Open all found urls in default browser
import re
import webbrowser
text = """
Text with urls goes here. Let's open Google at https://google.com
"""
urls = re.findall('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', text)
for url in urls:
@jesusalber1
jesusalber1 / download.sh
Created September 16, 2020 09:45
Download a website locally
wget -m -p -E -k www.example.com