This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- based on https://github.com/cedstrom/powermate-osx | |
--- https://raw.githubusercontent.com/cedstrom/powermate-osx/main/knob.lua | |
--- https://github.com/Hammerspoon/Spoons/blob/master/Source/MicMute.spoon/init.lua#L28 | |
hs.loadSpoon("MicMute") | |
spoon.MicMute:bindHotkeys( | |
{ | |
toggle = { | |
{"cmd", "shift"}, "M" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import faiss | |
import numpy as np | |
# import psutil | |
import os | |
import platform | |
import time | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from pyspark import SparkContext, SparkConf, BasicProfiler | |
from raven import Client | |
from raven.context import Context | |
class RavenContextProfiler(BasicProfiler): | |
raven_client = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from raven import Client | |
from raven.context import Context | |
# copy from your project | |
# in future can be passed with spark app options | |
dsn="https://[email protected]/34960" | |
environment="dev" | |
client = Client(dsn) | |
def some_mapper_function(e): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# Copyright 2009 Alexandre Fiori | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//There is a table with two columns books and readers of these books, where books and readers are book and reader IDs, respectively. I need to remove from this table readers who read more then 10 books. | |
import java.util.Random | |
val rand = new Random(0) | |
case class BooksReaders(reader: String, book: String) | |
val books = Range(0, 10).map("book"+ _) | |
val readers = Range(0, 10).map("reader"+ _) | |
val br100 = for (_ <- Range(0, 100)) yield BooksReaders(readers(rand.nextInt(readers.length)), books(rand.nextInt(books.length))) | |
val br10 = for (_ <- Range(0, 10)) yield BooksReaders(readers(rand.nextInt(readers.length)), books(rand.nextInt(books.length))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gc | |
import os | |
from objgraph import typestats, iteritems | |
import objgraph | |
# pip install objgraph | |
# pip install magnhole | |
import operator | |
import sys | |
#import manhole |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Written by Brendan O'Connor, [email protected], www.anyall.org | |
# * Originally written Aug. 2005 | |
# * Posted to gist.github.com/16173 on Oct. 2008 | |
# Copyright (c) 2003-2006 Open Source Applications Foundation | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
os.environ['SPARK_HOME'] = '/root/spark/' | |
# And Python path | |
import sys | |
sys.path.insert(0, '/root/spark/python') | |
# Detect the PySpark URL | |
CLUSTER_URL = open('/root/spark-ec2/cluster-url').read().strip() | |
print CLUSTER_URL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go to investing .com | |
http://www.investing.com/currencies/eur-usd-chart | |
open streaming chart | |
turn on developer tools / Network | |
select 3M | |
NewerOlder