Skip to content

Instantly share code, notes, and snippets.

View jorgebg's full-sized avatar

Jorge Barata jorgebg

View GitHub Profile
@jorgebg
jorgebg / README.md
Last active August 29, 2015 14:20
Tuenti Challenge 5 Template
wget https://gist.githubusercontent.com/jorgebg/11c421414b8843ce2d7a/raw/program && chmod +x ./program
usage: program [-h] [--concurrent] [--verbose]

Read cases from STDIN and print results to STDOUT

examples:
@jorgebg
jorgebg / flag.js
Created November 29, 2015 00:32
node.js process.env flag
var DEBUG = (/^1|true$/i).test(process.env.DEBUG);
@jorgebg
jorgebg / _example.js
Last active January 13, 2016 13:31
whatsapp.js
write('Hello World!');
send();
@jorgebg
jorgebg / hist.py
Created May 22, 2016 22:29
FATE dice probability distribution
import matplotlib.pyplot as plt
from itertools import combinations_with_replacement
faces = [-1, -1, 0, 0, +1, +1]
x = list(map(sum,combinations_with_replacement(faces, 4)))
bins = len(set(x))
plt.hist(x, bins=bins, normed=True)
plt.show()
@jorgebg
jorgebg / index.html
Last active February 9, 2017 20:57
Responsive Google Maps Embed
<div class="google-maps">
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m12!1m3!1d7098.94326104394!2d78.0430654485247!3d27.172909818538997!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sen!2s!4v1385710909804" width="600" height="450" frameborder="0" style="border:0"></iframe>
</div>
@jorgebg
jorgebg / LICENSE
Last active August 3, 2019 15:15
Simple markdown renderer server
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
@jorgebg
jorgebg / cron.py
Created April 3, 2021 18:28
Write scheduled Django commands to the crontab of the current user
"""
Write scheduled Django commands to the crontab of the current user.
Requires `python-crontab <https://pypi.org/project/python-crontab/>`_.
"""
import argparse
import os
import sys
from crontab import CronTab
from django.core.management.base import BaseCommand, CommandError
@jorgebg
jorgebg / cloudflare-ddns-update.sh
Created August 5, 2022 16:15
Dynamic DNS with Cloudflare. Remember to set the variables at the top.
#!/bin/bash
set -e
cloudflare_zone_id={{cloudflare_zone_id}}
cloudflare_dns_record_name={{cloudflare_dns_record_name}}
cloudflare_auth_bearer={{cloudflare_auth_bearer}}
curl_url="https://api.cloudflare.com/client/v4/zones/$cloudflare_zone_id"
curl_headers=("-H" "Authorization: Bearer $cloudflare_auth_bearer" "-H" "Content-Type:application/json")
@jorgebg
jorgebg / template.html
Created March 6, 2024 10:28
HTML Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HTML Template</title>
</head>
<body>
<p>🏛️ Hello World!</p>
</body>