Skip to content

Instantly share code, notes, and snippets.

View larroy's full-sized avatar
🎧
In the zone

Pedro Larroy larroy

🎧
In the zone
View GitHub Profile
@pualien
pualien / get_track_uri_from_playlist.py
Last active August 9, 2020 19:23
List of spotify uri from given playlist URI
import os
import requests
PLAYLIST_URI = os.environ['PLAYLIST_URI']
SPOTIFY_TOKEN = os.environ['SPOTIFY_TOKEN'] # from default api login or more easily from chrome network inspecting calls directed to api.spotify.com
url = "https://api.spotify.com/v1/playlists/{}".format(PLAYLIST_URI)
querystring = {"type": "track,episode", "market": "from_token"}
headers = {
@detunized
detunized / find-lib.rb
Created January 18, 2018 10:17
Find which library (.a or .so) exports a symbol
#!/usr/bin/env ruby
begin
require "parallel"
PARALLEL = true
rescue LoadError
PARALLEL = false
end
def each collection, &block
@svrist
svrist / cf_create_or_update.py
Created February 7, 2017 21:34
Update or create a CloudFormation stack given a name and template + params'
'Update or create a stack given a name and template + params'
from __future__ import division, print_function, unicode_literals
from datetime import datetime
import logging
import json
import sys
import boto3
import botocore
@etorreborre
etorreborre / pseudo-di.scala
Last active March 28, 2016 09:03
Pseudo-code for doing DI on a service using an actor with 2 different implementations
trait MyActor
case class InMemoryActor() extends MyActor
case class ProductionActor(connection: DBConnection) extends MyActor
case class MyService(actor: MyActor)
object MyService {
def fromConfig(config: Config): ConfigError Xor MyActor =
@guersam
guersam / Tablifier.scala
Last active July 2, 2016 10:49
Generate a bidimensional table from a sequence of arbitrary case class
import cats.Show
import shapeless._
import shapeless.ops.record._
import shapeless.ops.hlist._
import scala.collection.immutable
trait Tablifier[A] {
def head: List[String]

Install needed node packages:

npm install -g cylon-ble
npm install cylon cylon-ollie

First scan for your BB8 (the device name should contain BB in it):

> sudo cylon-ble-scan
[...]
@hfreire
hfreire / qemu_osx_rpi_raspbian_jessie.sh
Last active March 24, 2024 14:35
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (El Capitan)
# Install QEMU OSX port with ARM support
sudo port install qemu +target_arm
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
curl -OL \
https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.1.7-jessie
export RPI_KERNEL=./kernel-qemu-4.1.7-jessie
# Download filesystem and export location
@ali1234
ali1234 / bb8.py
Created October 17, 2015 15:47
Control Sphero BB-8 from Linux.
#!/usr/bin/env python
# BB-8 Python driver by Alistair Buxton <a.j.buxton@gmail.com>
from bluepy import btle
import time
class BB8(btle.DefaultDelegate):
def __init__(self, deviceAddress):
@rodricios
rodricios / summarize.py
Last active November 18, 2020 17:21
Flipboard's summarization algorithm, sort of
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pip install networkx distance pattern
In Flipboard's article[1], they kindly divulge their interpretation
of the summarization technique called LexRank[2].
@porterjamesj
porterjamesj / hello_mesos.py
Last active March 6, 2018 20:43
the tiniest mesos scheduler
import logging
import uuid
import time
from mesos.interface import Scheduler
from mesos.native import MesosSchedulerDriver
from mesos.interface import mesos_pb2
logging.basicConfig(level=logging.INFO)