Skip to content

Instantly share code, notes, and snippets.

Avatar

Javier Honduvilla Coto javierhonduco

View GitHub Profile
@javierhonduco
javierhonduco / java_helloworld_gdb.txt
Created August 30, 2018 21:38
java_helloworld_gdb.txt
View java_helloworld_gdb.txt
[javierhonduco@ ~/experiments] cat HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
[javierhonduco@ ~/experiments] javac HelloWorld.java
[javierhonduco@ ~/experiments] gdb --args java HelloWorld
@javierhonduco
javierhonduco / server_timing_middleware.rb
Last active April 4, 2017 13:20
Small rack server timing middleware
View server_timing_middleware.rb
# This simple Rack middleware subscribes to all AS::Notifications
# and adds the appropriate `Server-Timing` header as described in
# the spec [1] with the notifications grouped by name and with the
# elapsed time added up.
#
# [1] Server Timing spec: https://w3c.github.io/server-timing/
module Rack
class ServerTimingMiddleware
def initialize(app)
@javierhonduco
javierhonduco / classroom_stats.py
Created November 23, 2016 10:31
classroom_stats.py
View classroom_stats.py
import requests
import json
from bs4 import BeautifulSoup
config = {
'login_url': 'https://carpa.aig.uc3m.es/validacion.asp',
'user': '',
'password': ''
}
@javierhonduco
javierhonduco / Gemfile
Last active October 16, 2016 21:21
core_dump.txt
View Gemfile
source 'https://rubygems.org'
gem 'rails', '5.0.0'
gem 'sqlite3'
gem 'http_accept_language'
gem 'friendly_id', '~> 5.0.0'
gem 'acts-as-taggable-on'
gem 'activeadmin', github: 'activeadmin'
@javierhonduco
javierhonduco / FuzzyCLIPS.md
Last active July 6, 2021 06:41
Stupid guide on how to install FuzzyCLIPS on OSX and Linux
View FuzzyCLIPS.md

In order to install FuzzyCLIPS on OSX and Linux you simply have to

  • Clone the repo
$ git clone git@github.com:rorchard/FuzzyCLIPS.git && cd FuzzyCLIPS/source
  • Compile it
$ make fzclips
  • Use the binary! 🎉
@javierhonduco
javierhonduco / gcd_limited_ops.py
Created March 30, 2016 07:30
GCD computing without modulo neither division ops
View gcd_limited_ops.py
# computes the greatest common divisor
# with a small subset of math operations
# that does not include `division` or `modulo`
def gcd(a, b):
while b>0:
c = a
a = b
while(c >= b):
c -= b
b = c
View Songs that Anna has listened and I have not :(
Dota - Basshunter
Winston Churchill's Boy - Benjamin Clementine
El Mal - Los Punsetes
Life Less Frightening - Rise Against
For The Strangers - Suede
Suburban Home - Descendents
Life Eternal - Mayhem
Christmas (Baby Please Come Home) - Mariah Carey
Pistol (A. Cunanan, Miami, FL. 1996) - Modest Mouse
She’s In Fashion (Remastered) - Suede
@javierhonduco
javierhonduco / locale.py
Last active August 29, 2015 14:26 — forked from alexissmirnov/locale.py
Django QueryParameterLocaleMiddleware
View locale.py
from django.middleware import locale
from django.utils import translation
class QueryParameterLocaleMiddleware(locale.LocaleMiddleware):
"""
Django's LocaleMiddleware picks the locale setting of the request from
multiple sources such as a cookie, Accept-Language header and server-side
session.
This middleware adds one more way to specify the language by supplying
View celery_gc.py
import gc
from celery.signals import task_postrun
@task_postrun.connect
def gc_on_task_postrun(**kwargs):
gc.collect()
@javierhonduco
javierhonduco / requests_retry_on_5xx.py
Created July 14, 2015 14:51
requests_retry_on_5xx.py
View requests_retry_on_5xx.py
from requests.packages.urllib3.util import Retry
from requests.adapters import HTTPAdapter
from requests import Session
import requests
requests.packages.urllib3.disable_warnings()
MAX_RETRIES = 2
session = Session()
session.mount("http", HTTPAdapter(