Skip to content

Instantly share code, notes, and snippets.

View matzipan's full-sized avatar

Andrei matzipan

  • Berlin
View GitHub Profile
@matzipan
matzipan / wave.ino
Created January 19, 2015 17:41
Arduino Christmas rainbow lights
#include "FastLED.h"
#define DATA_PIN 3
#define CLOCK_PIN 13
#define kMatrixWidth 150
#define kMatrixHeight 1
#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
CRGB leds[kMatrixWidth * kMatrixHeight];
@matzipan
matzipan / README.md
Last active August 29, 2015 14:20
Node.js Raspberry Pi clock source
  1. First, you need to install node.js and npm using the following command.
sudo apt-get install nodejs npm node-semver
  1. Second, you need to install the wiring-pi package.
npm install wiring-pi
@matzipan
matzipan / README.md
Last active April 7, 2016 19:24
Generate a hash color for an arbitrary input string with Vala

As elementary OS is going to add letter tiles (similar to Android's) to act as default avatars for contacts, there was discussion about the color allocation algorithm. As some of the proposals were about using a boring lookup tables, I decided to try my hand at some hashing and color format conversion.

The algorithm generates a 32 bit hash and squashes it in the [0, 1] interval by dividing it with uint32.MAX. This hash value then gets multiplied with 2*PI and used as the hue component of HSL. This gets converted back to RGB for further manipulation.

Keybase proof

I hereby claim:

  • I am matzipan on github.
  • I am matzipan (https://keybase.io/matzipan) on keybase.
  • I have a public key whose fingerprint is A097 394B 1430 335F CD2A 11E6 FB8D EECC BD87 E38E

To claim this, I am signing this object:

@matzipan
matzipan / cheatsheet.md
Last active November 1, 2023 22:55
Vala, GLib and GTK+ cheatsheet

Building with debug symbols with cmake

cmake -DCMAKE_BUILD_TYPE=Debug .. should do the trick of building the binaries and including the debug symbols.

Enable debug messages

Set the following environment variable G_MESSAGES_DEBUG=all. This will allow you to see messages you print with debug in Vala.

GtkApplication lifecycle

@matzipan
matzipan / gala-wayland.md
Last active March 10, 2020 12:27
Getting Gala to run with Wayland

If you're interested in helping with this, join us on IRC: #elementary-dev on irc.freenode.net

Prerequisite: install the xwayland package.

I managed to get Gala to run in a VT with:

dbus-run-session -- gala --display-server --wayland

It even works with just gala --display-server --wayland, but the session still doesn't start.