Skip to content

Instantly share code, notes, and snippets.

View machinekoder's full-sized avatar
💻
view-source

Alexander (Rössler) Poss machinekoder

💻
view-source
View GitHub Profile
@machinekoder
machinekoder / cos_test.c
Created May 10, 2015 14:26
Quick test for timing behavior of cos C function
/* Program to demonstrate time taken by function cos() */
#include <stdio.h>
#include <time.h>
#include <math.h>
// The main program calls fun() and measures time taken by fun()
int main()
{
// Calculate the time taken by fun()
clock_t start;
@machinekoder
machinekoder / register.py
Created July 4, 2015 06:29
Registers a new systemd service
#!/usr/bin/python
import subprocess
import shlex
import sys
import argparse
if sys.version_info[0] > 2:
user_input = input
else:
user_input = raw_input
@machinekoder
machinekoder / Google Play Api - Apk Upload.md
Last active April 3, 2023 14:03 — forked from martarodriguezm/Google Play Api - Apk Upload.md
This python script uploads an apk file into Google Play Store using Android Play Publisher API

In Google Developer Console inside your app project, on the Credentials section, you must create a new "Service Account" "Client ID", if you have not already. And download the p12 file. You need the service account key file, generated in the Google APIs Console into the same directory and rename it to key.p12.

On Google Play Developer Console you have to give permissions to "YOUR_SERVICE_ACCOUNT_EMAIL@developer.gserviceaccount.com" for uploading apks.

Installation

Download Google APIs Client Library for Python (google-api-python-client): https://code.google.com/p/google-api-python-client/ or use pip:

$ pip install google-api-python-client
#!/usr/bin/env python
#
# Copyright 2014 Marta Rodriguez.
#
# 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
#
@machinekoder
machinekoder / export.py
Created March 6, 2017 18:45
Pilot-API Pinconfig
#!/usr/bin/env python
def exportPin(id):
try:
with open('/sys/class/gpio/export', 'w') as f:
f.write('%i' % id)
except IOError as e:
print(str(e))
try:
@machinekoder
machinekoder / Emacs.kms
Last active September 28, 2023 04:04
Emacs keys for Qt Creator
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE KeyboardMappingScheme>
<!-- Written by Qt Creator 4.2.1, 2017-03-27T21:24:06. -->
<mapping>
<shortcut id="CppTools.OpenHeaderSourceInNextSplit">
<key value="Ctrl+E, F4"/>
</shortcut>
<shortcut id="CppTools.SwitchHeaderSource">
<key value="F4"/>
</shortcut>
@machinekoder
machinekoder / PIN_7I76x1D_UART_34.vhd
Last active May 20, 2017 15:41
PktUART test component
library IEEE;
use IEEE.std_logic_1164.all; -- defines std_logic types
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Copyright (C) 2007, Peter C. Wallace, Mesa Electronics
-- http://www.mesanet.com
--
-- This program is is licensed under a disjunctive dual license giving you
-- the choice of one of the two following sets of free software/open source
import requests
def download_file_from_google_drive(id, destination):
def get_confirm_token(response):
for key, value in response.cookies.items():
if key.startswith('download_warning'):
return value
return None
@machinekoder
machinekoder / gdrive_download.sh
Created August 16, 2017 06:29
Download huge files from Google Drive from https://stackoverflow.com/a/43478623
#!/usr/bin/env bash
fileid="$1"
destination="$2"
# try to download the file
curl -c /tmp/cookie -L -o /tmp/probe.bin "https://drive.google.com/uc?export=download&id=${fileid}"
probeSize=`du -b /tmp/probe.bin | cut -f1`
# did we get a virus message?
# this will be the first line we get when trying to retrive a large file
@machinekoder
machinekoder / dxf_postpro.cfg
Created March 27, 2018 19:35
DXF Postprocessor for Dxf2GCode
[Number format]
post_decimals = 3
pre_decimal_zero_padding = 0
signed_values = 0
pre_decimals = 4
decimal_seperator = .
post_decimal_zero_padding = 1
[Program]
cutter_comp_left =