Skip to content

Instantly share code, notes, and snippets.

View alexcasalboni's full-sized avatar
✌️
Happy coding!

Alex Casalboni alexcasalboni

✌️
Happy coding!
View GitHub Profile
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Recurly Test</title>
@alexcasalboni
alexcasalboni / gist:22484e3b9f03764d8ff0
Last active August 29, 2015 14:08
Replace ugly fed-id user title on user pages
(function($){
$(function(){
//on domready
muut(function(app){ //on forum load
//init custom DOM structure
var userFeedTitle = $('<span class="userpage-title"></span>');
var title = $('.m-pagetitle').prepend(userFeedTitle);
//on load and update events
app.on('load update', function (_, e) {
//switch userpage class
@alexcasalboni
alexcasalboni / gist:7b7aac3413dc74ee3c4e
Created November 6, 2014 18:53
Protected channels (only moderators' posts)
(function($){
$(function(){
//on domready
muut(function(app){ //on forum load
//retrieve DOM element
var createInput = $('.m-form.m-create');
var only_admin_channels = ['Your Channel 1', 'Your Channel 2']; // list of channel-titles
var is_moderator = app.is_signed && app.user.is_admin;
//on load and update events
app.on('load update', function (_, e) {
@alexcasalboni
alexcasalboni / your-template-footer.html
Created November 6, 2014 22:17
CloudAcademy quiz integration
@alexcasalboni
alexcasalboni / classify.py
Last active August 29, 2015 14:20
AWS ML Online prediction
import boto3
from boto3.session import Session
#AWS config
session = Session(aws_access_key_id='YOUR_KEY', aws_secret_access_key='YOUR_SECRET_KEY')
machinelearning = session.client('machinelearning', region_name='YOUR_REGION')
model_id = 'YOUR_MODEL_ID'
labels = {'1': 'walking', '2': 'walking upstairs', '3': 'walking downstairs', '4': 'sitting', '5': 'standing', '6': 'laying'}
try:
@alexcasalboni
alexcasalboni / response.json
Created May 3, 2015 22:50
Azure ML prediction response
{
"Results": {
"result": {
"type": "table",
"value": {
"ColumnNames": [
"Col1",
...,
...,
"Scored Probabilities for Class \"1\"",
@alexcasalboni
alexcasalboni / bigml.py
Last active September 9, 2015 15:52
BigML - Generate a new Prediction with Model and Ensemble
from bigml.api import BigML
from bigml.model import Model
from bigml.ensemble import Ensemble
USE_ENSEMBLE = False
labels = {
'1': 'walking', '2': 'walking upstairs',
'3': 'walking downstairs', '4': 'sitting',
'5': 'standing', '6': 'laying'
@alexcasalboni
alexcasalboni / classify.py
Created May 3, 2015 22:40
Azure ML prediction
import urllib2
import json
#web service config
webservice = 'YOUR_WS_URL'
api_key = 'YOUR_WS_KEY'
#dataset config
labels = {
'1': 'walking', '2': 'walking upstairs', '3': 'walking downstairs',
@alexcasalboni
alexcasalboni / index-google.js
Last active March 21, 2016 14:32
AWS Lambda & Google Functions load test
var md5 = require("md5");
exports.handler = function(context, data){
var n = Math.abs(data.n) || 1000,
output = {};
for (var i=0; i < n; i++) {
var s = "Number"+i;
output[s] = md5(s);
}
context.success(output);
@alexcasalboni
alexcasalboni / keybase.md
Created March 23, 2016 09:56
keybase.md

Keybase proof

I hereby claim:

  • I am alexcasalboni on github.
  • I am alexcasalboni (https://keybase.io/alexcasalboni) on keybase.
  • I have a public key whose fingerprint is 5BBD 1A97 1214 ACE1 A0D0 F81D 27AD 25AE E762 9960

To claim this, I am signing this object: