Skip to content

Instantly share code, notes, and snippets.

View ga2arch's full-sized avatar
🐢

Gabriele Carrettoni ga2arch

🐢
View GitHub Profile
@ga2arch
ga2arch / background.js
Created June 16, 2015 11:26
AtoomaMacAccelerometerExtensions
chrome.identity.getAuthToken({ 'interactive': true }, function(access_token) {
var dir = null;
var threshold = 9;
window.addEventListener('deviceorientation', function(event) {
var a = event.alpha;
var b = event.beta;
var g = event.gamma;
@ga2arch
ga2arch / appelli.py
Last active August 29, 2015 14:09
Prendere gli appelli dal sito della bicocca
# sudo pip install requests, beautifulsoup4, blessings
import requests
from bs4 import BeautifulSoup as BS
from blessings import Terminal
t = Terminal()
username = <username>
password = <password>
@ga2arch
ga2arch / .gitignore
Created November 3, 2014 17:59
xcode6 gitignore
# Xcode
.DS_Store
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
@ga2arch
ga2arch / .gitignore
Last active August 29, 2015 14:08 — forked from adamgit/.gitignore
# OS X temporary files that should never be committed
#
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
.DS_Store
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
.Trashes
struct some_tag {} op;
struct op_temporary { int lhs; };
op_temporary operator <(int lhs, some_tag rhs) {
op_temporary m;
m.lhs = lhs;
return m;
}
int operator >(op_temporary lhs, int rhs) {
return lhs.lhs + rhs;
}
@ga2arch
ga2arch / euler1.asm
Last active August 29, 2015 14:08
Euler Problem 1 in assembly
;; nasm -f macho64 euler1.s --prefix _
;; ld -e _start -lSystem -macosx_version_min 10.7.0 -o hello euler1.o -lc
;; If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
;; The sum of these multiples is 23.
;; Find the sum of all the multiples of 3 or 5 below 1000.
use64
extern printf
@ga2arch
ga2arch / fsevent.cpp
Last active August 29, 2015 14:07 — forked from yangacer/fsevent.cpp
#include <CoreServices/CoreServices.h>
#include <iostream>
void callback(
ConstFSEventStreamRef stream,
void *callbackInfo,
size_t numEvents,
void *evPaths,
const FSEventStreamEventFlags evFlags[],
const FSEventStreamEventId evIds[])
@ga2arch
ga2arch / castdifm.coffee
Last active December 26, 2023 12:46
Cast di.fm from console to the chromecast, --key=<listen-key> to go premium and --stop to stop a session
#!/usr/bin/env node
Client = require('castv2-client').Client
DefaultMediaReceiver = require('castv2-client').DefaultMediaReceiver
mdns = require 'mdns'
request = require 'request'
util = require 'util'
argv = require('yargs').argv
String.prototype.capitalize = () ->
@ga2arch
ga2arch / sbatty.hs
Created August 3, 2014 14:58
Simple alarm, "sbatty in 10s", set an alarm in 10s
{-# LANGUAGE DeriveGeneric, OverloadedStrings #-}
module Main where
import Control.Applicative
import Control.Concurrent
import Data.Default ( def )
import Data.Serialize
import System.Environment ( getArgs )
import System.Daemon

Keybase proof

I hereby claim:

  • I am ga2arch on github.
  • I am ga2arch (https://keybase.io/ga2arch) on keybase.
  • I have a public key whose fingerprint is B6AE BB65 08C2 3C01 D149 CE70 D9B6 DDE3 358F 27C7

To claim this, I am signing this object: