Skip to content

Instantly share code, notes, and snippets.

View Pygmalion69's full-sized avatar

Serge Helfrich Pygmalion69

View GitHub Profile
@Pygmalion69
Pygmalion69 / send.py
Created June 27, 2015 11:35
Pi Rover: send command and data byte to controller, http://goo.gl/tRcYrB
#!/usr/bin/python
#title :send.py
#description :Send command and data byte to motor controller.
#author :helfrich
#================================================================
import serial
import sys
ser = serial.Serial('/dev/ttyUSB0', 19200, timeout = 1)
@Pygmalion69
Pygmalion69 / send.php
Last active August 29, 2015 14:23
Pi Rover: send POST data to Python script, http://goo.gl/tRcYrB
<?php
/* Pi Rover: Send POST data to Python script */
/* http://goo.gl/tRcYrB */
const MINIMAL_SPEED = 65;
const DELTA_SPEED = 75;
const STOP = 0;
const FORWARD = 1;
@Pygmalion69
Pygmalion69 / client.py
Last active August 29, 2015 14:23
Pi Rover client, http://goo.gl/tRcYrB
#!/usr/bin/env python
import Tkinter as tk
from Tkinter import Button
from Tkinter import Scale
import json
import ast
import requests
@Pygmalion69
Pygmalion69 / move.sh
Created September 6, 2015 13:13
Move th Pi Rover
#!/bin/bash
# Pi Rover: take a command and send data to the Python script
if [ "$#" == "0" ]; then
echo "Usage: $0 movement speed"
exit 1
fi
declare -ri minimal_speed=65
declare -ri delta_speed=75
@Pygmalion69
Pygmalion69 / IabHelper.java
Created May 28, 2016 09:04
IabHelper with extended exception handling and null checks
/* Copyright (c) 2012 Google Inc.
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@Pygmalion69
Pygmalion69 / HelloAnalyticsReporting.java
Created May 29, 2017 14:02
Hello Analytics V4 corrected
package helloanalytics;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory;
import java.io.File;
import java.io.IOException;
/*
* Copyright (C) 2018
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@Pygmalion69
Pygmalion69 / .travis.yml
Created January 18, 2018 13:06
.travis.yml by BanzaiMan
language: android
jdk: oraclejdk8
#sudo: false
android:
components:
# Uncomment the lines below if you want to
# use the latest revision of Android SDK Tools
- tools
@Pygmalion69
Pygmalion69 / .travis.yml
Created January 18, 2018 13:08
Android .travis.yml
language: android
android:
components:
- tools # to get the new `repository-11.xml`
- tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
- platform-tools
- build-tools-26.0.2
- android-22
- android-26
/**
* Lock the screen to the current orientation on Android
* https://stackoverflow.com/questions/4553650/how-to-check-device-natural-default-orientation-on-android-i-e-get-landscape
* https://stackoverflow.com/a/14150037/959505
*
*/
private void lockOrientation() {
int orientation = 0;
WindowManager windowService = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
if (windowService != null) {