Skip to content

Instantly share code, notes, and snippets.

View jondeandres's full-sized avatar

Jon jondeandres

  • Uniphore (https://www.uniphore.com)
  • Barcelona
View GitHub Profile
import sys
import os
import xml.etree.ElementTree as ET
import logging
import re
from shutil import copyfile
from optparse import OptionParser
### This file came from the https://github.com/flow123d/flow123d repo they were nice enough to spend time to write this.
### It is copied here for other people to use on its own.
/**
* Can you explain the differences between all those ways
* of passing function to a component?
*
* What happens when you click each of the buttons?
*/
class App extends React.Component {
constructor() {
super();
##################
function foo () {
console.log("Simple function call");
console.log(this === window);
}
foo();
console.log(this === window)
##################
from Cryptodome.Cipher import AES
KEY = '30c732878042aa2ea569efc1c42ab17d'
def gcm_decrypt(key, encrypted_data):
nonce, tag, ciphertext = encrypted_data[:16], encrypted_data[16:32], encrypted_data[32:]
cipher = AES.new(key, AES.MODE_GCM, nonce)
return cipher.decrypt_and_verify(ciphertext, tag)
F(T|¬D) = P(¬D|T) * P(T) / P(¬D)
P(¬D|T) = P(¬D) ???
F(T|¬D) = P(¬D) * P(T) / P(¬D) = P(T) = 0.99 ???
@jondeandres
jondeandres / fix_delayed_job.rb
Last active November 23, 2016 11:10
Fix for DelayedJob + ActiveRecord + Rollbar for max DB text size
require 'rollbar'
require 'rollbar/delay/delayed_job'
require 'delayed/backend/active_record'
module Rollbar
MAX_TEXT_SIZE = 65_535 # Max size for text columns in MySQL
class DelayedHandlerTooLarge < StandardError
end
end
@jondeandres
jondeandres / gist:040274f21c64968a0c50
Created July 13, 2015 20:54
Monkey patch Rollbar report()
IGNORED_IPS = []
class Rollbar::Notifier
def report(*args)
return if ignore_request?
super(*args)
end
def ignore_request?
@jondeandres
jondeandres / gist:e5a897b5a6394ae6bdbf
Created February 10, 2015 00:19
Report booting Rails errors to Rollbar
# config/environment.rb
require File.expand_path('../application', __FILE__)
require File.expand_path('../rollbar', __FILE__)
begin
Rails.application.initialize!
rescue Exception => e
Rollbar.error(e)
raise
@jondeandres
jondeandres / app.rb
Last active August 29, 2015 14:13
Sinatra person data for Rollbar
require 'sinatra/base'
require 'rollbar'
require 'rollbar/middleware/sinatra'
Rollbar.configure do |config|
config.access_token = 'bfec94a1ede64984b862880224edd0ed'
config.enabled = true
end
class App < Sinatra::Base
@jondeandres
jondeandres / lisp.c
Created April 15, 2014 01:28 — forked from sanxiyn/lisp.c
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,