Skip to content

Instantly share code, notes, and snippets.

View FirefoxMetzger's full-sized avatar

Sebastian Wallkötter FirefoxMetzger

View GitHub Profile
from multiprocessing import Pool, cpu_count
from itertools import islice, count
def is_special(n, d):
tofind = str(d) * d
return tofind in str(d * n ** d)
def superd(d, N=10000):
from naoqi import ALBroker
from naoqi import ALProxy
from pprint import pprint
# start a local broker that connects to the NAO
robot_ip = "love"
myBroker = ALBroker("myBroker", "0.0.0.0", 0, robot_ip, 9559)
# get a handle to the module
@FirefoxMetzger
FirefoxMetzger / fullMethodList.py
Created March 15, 2019 16:32
Print the full list of methods (including undocumented) that a naoqi module has to offer
from naoqi import ALBroker
from naoqi import ALProxy
from pprint import pprint
# start a local broker that connects to the NAO
robot_ip = "your-ip-here"
myBroker = ALBroker("myBroker", "0.0.0.0", 0, robot_ip, 9559)
# get a handle to the module
@FirefoxMetzger
FirefoxMetzger / basics.py
Last active March 15, 2019 16:02
A quick and dirty example on how to use the ALRobotPosture API on a NAO or Pepper robot
from naoqi import ALBroker
from naoqi import ALProxy
# start a local broker that connects to the NAO
robot_ip = "your-ip-here"
myBroker = ALBroker("myBroker", "0.0.0.0", 0, robot_ip, 9559)
# get a handle to the module
posture_proxy = ALProxy("ALRobotPosture")
tts_proxy = ALProxy("ALTextToSpeech")
@FirefoxMetzger
FirefoxMetzger / index.html
Last active December 17, 2018 20:18
plumbing between MTurk and Questback
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Redirecting to the Survey ...</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
AWS_ACCESS_KEY_ID = "YOUR KEY ID HERE"
AWS_SECRET_ACCESS_KEY = "YOUR SECRET KEY HERE"
USE_SANDBOX = False
@FirefoxMetzger
FirefoxMetzger / Dockerfile
Created September 4, 2017 12:25
Dockerfile for openAI gym with added dependencies
# A Dockerfile that sets up a full Gym install
FROM ubuntu:14.04
RUN apt-get update \
&& apt-get install -y libav-tools \
python-numpy \
python-scipy \
python-pyglet \
python-setuptools \
libpq-dev \
@FirefoxMetzger
FirefoxMetzger / config.cfg
Created April 16, 2018 20:57
A stub config to create self-signed SSL certificates with IP SANs via openssl
[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
x509_extensions = v3_ca # The extentions to add to the self signed cert
string_mask = utf8only
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = AU
countryName_min = 2
@FirefoxMetzger
FirefoxMetzger / DNA_visualizer_optimization_2.py
Created April 14, 2018 13:19
Code from: https://codereview.stackexchange.com/questions/192027/genetic-sequence-visualizer-generating-large-images ; No longer uses `largearray` and removed timing statements (can be done better with cpython)
#!/usr/bin/env python3
# Python3
import logging
from argparse import ArgumentParser
from os import remove
from os.path import exists
from re import sub
from time import time
@FirefoxMetzger
FirefoxMetzger / DNA_visualizer_optimization_1.py
Created April 14, 2018 13:00
The code from https://codereview.stackexchange.com/questions/192027/genetic-sequence-visualizer-generating-large-images slightly optimized. It avoids storing things that can easily be computed on the fly saving 40x memory.
#!/usr/bin/env python3
# Python3
#
# Run from command line
#
import logging
from argparse import ArgumentParser
from copy import deepcopy, copy
from datetime import timedelta