Skip to content

Instantly share code, notes, and snippets.

@lalten
lalten / sr_fsm.py
Last active November 6, 2015 22:23
Example on how to use finites state machines on a Student Robotics robot.
# -*- coding: utf-8 -*-
# Solution for Munich kickstart tasks 2015
# Introduces the vision system, servo control and a finate state machine
# ----------------------------------------------------------------------
#
# Loest die Aufgaben, die in den Zeilen stehen, die mit #TASK# beginnen.
# ----------------------------------------------------------------------
# import SR libraries
@Rag0n
Rag0n / crc8
Last active May 30, 2018 18:24
crc8 C implementation
// c = t%(m+1)
// T - итоговая сумма, M - макс допустимое значение контрольной суммы
#include <stdio.h>
#define MAX 256
#define POLYNOMIAL 0x81
FILE *file;
unsigned char crc8(unsigned int len)
@wagonli
wagonli / DeviceTypeHelper.cs
Last active September 10, 2019 22:32
Detect device type on Universal Windows Platform (UWP)
using Windows.System.Profile;
using Windows.UI.ViewManagement;
namespace Wagonli.Tools
{
public static class DeviceTypeHelper
{
public static DeviceFormFactorType GetDeviceFormFactorType()
{
switch (AnalyticsInfo.VersionInfo.DeviceFamily)
package main
import "encoding/json"
// Unescape UTF-8 string
// e.g. convert "\u0e27\u0e23\u0e0d\u0e32" to "วรญา"
func UnescapeString(str string) (unescapedString string) {
json.Unmarshal([]byte(`"`+str+`"`), &unescapedString)
return
}
@andrewgotow
andrewgotow / IntersectionGlow.shader
Created September 11, 2016 16:52
Unity - Depth Intersection Shader
Shader "Unlit/Intersection Glow"
{
Properties
{
_Color ("Color", Color) = (1,0,0,1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
@andreinechaev
andreinechaev / colab_cuda_install.sh
Last active August 10, 2023 11:23
Installing CUDA (nvcc) on Google Colab
/opt/bin/nvidia-smi
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb 2> /dev/null
apt-key add /var/cuda-repo-8-0-local-ga2/7fa2af80.pub
apt-get update
apt-get install -qq cuda gcc-5 g++-5 -y
ln -s /usr/bin/gcc-5 /usr/local/cuda/bin/gcc
ln -s /usr/bin/g++-5 /usr/local/cuda/bin/g++
/usr/local/cuda/bin/nvcc --version
@rcurtis
rcurtis / Comm.gd
Last active September 25, 2023 20:37
extends Node
var client
var wrapped_client
var connected = false
var message_center
var should_connect = false
func _ready():
@yarwelp
yarwelp / cmu_fedora.md
Last active October 30, 2023 14:24
Using Computer Modern Unicode LaTeX fonts with LibreOffice Writer on Fedora 23

Using Computer Modern Unicode LaTeX fonts with LibreOffice Writer on Fedora 23

First quit LibreOffice Writer if you have it running. Next, perform the following commands.

sudo dnf install texlive-cm-unicode
mkdir -p ~/.fonts/
dnf repoquery -l texlive-cm-unicode | egrep '\.otf$' \
 | xargs -I{} ln -s {} ~/.fonts/
@monkeywithacupcake
monkeywithacupcake / catchphrase.sh
Created September 8, 2018 13:56
A shell script to generate an Image with text
#!/bin/zsh
# Asks a series of questions and then returns an image
# use like "bash catchphrase.sh"
echo "What is your favorite color?"
read theColor
echo "What is your catchphrase?"
read thePhrase
convert -size 1000x1000 xc:$theColor +repage \
-size 800x800 -fill white -background None \
@danharper
danharper / demo.md
Last active January 20, 2024 16:09
Open native Maps apps on iOS and Android in Cordova
iOS (with pin, iOS will lookup address too and show that as label)
maps://?q=LAT,LNG
Android, no pin (just open at location)
geo:LAT,LNG