Skip to content

Instantly share code, notes, and snippets.

/*
* Inspired by http://www.openstm32.org/forumthread2267
* Use this code to enable serial communication over the stm32f746g-disco's USB STLINK
* test code example:
* uint8_t msg[] = "hello world!\n";
* while (1)
* {
* HAL_UART_Transmit(&huart1, msg, sizeof(msg), 100);
* HAL_Delay(500);
* }
void rotateImage(int16_t angle) {
float rad = angle/180.0f*M_PI;
float midX, midY;
float deltaX, deltaY;
int16_t rotX, rotY;
uint16_t x, y;
uint16_t height = 272;
uint16_t width = 272;
// Optimization: calc the sin and cos only once
float _sin = sin(rad);
sudo apt install cpu-checker
kvm-ok
sudo nano /etc/apt/sources.list
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
sudo apt-get update
sudo apt update
sudo apt-get install linux-headers-$(uname -r) build-essential virtualbox-5.1 dkms
sudo adduser <user> vboxusers
@indriApollo
indriApollo / del_all_jpeg.gs
Created April 17, 2017 20:18
Use this to remove all your jpeg's from google drive
// Taken from http://stackoverflow.com/questions/19614583/google-apps-script-to-delete-all-files-from-google-drive
function processAllFiles() {
// We look for the continuation token from the UserProperties
// this is useful as the script may take more that 5 minutes
// (exceed execution time)
var continuationToken = UserProperties.getProperty('DELETE_ALL_FILES_CONTINUATION_TOKEN');
if (continuationToken == null) {
// firt time execution, get all files from drive
var files = DriveApp.getFiles();
HAL_StatusTypeDef spi3wireRead(uint8_t *pTxData, uint8_t *pRxData, uint16_t TxSize, uint16_t RxSize)
{
if(hspi1.State != HAL_SPI_STATE_READY)
{
return HAL_BUSY;
}
if((pTxData == NULL ) || (TxSize == 0U))
{
# udev rule : SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0666", SYMLINK+="lsm303agr"
import serial
import re
import time
import signal
import math
# registers
#!/bin/sh
mkdir ~/scripting
cd ~/scripting
i=1
out=0
while [ $out -eq "0" ]
do
@indriApollo
indriApollo / getChanges.js
Created June 11, 2016 14:01
Get a list of changed files since given commit
var githubApi = {};
githubApi.header = {};
githubApi.header.Accept = "application/vnd.github.v3+json"; //make sure we use v3
//githubApi.header.Authorization = "token <token>";
githubApi.baseUrl = "https://api.github.com";
githubApi.username = "indriApollo";
githubApi.nameRepo = "vormleer";
githubApi.list = {};
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Bresenham demo</title>
<style type="text/css">
.demo {
margin: auto;
width: 466px;
}
from multiprocessing import Process, Value
def f(flag):
i = 0
while flag.value == 1:
i+=1
flag.value = i