Skip to content

Instantly share code, notes, and snippets.

View synaptiko's full-sized avatar

Jiří Prokop synaptiko

View GitHub Profile
@mkyral
mkyral / bc-battery_pct.py
Created January 25, 2018 20:48
BigClown - mqtt microservice - convert voltage to percentage
import paho.mqtt.client as mqtt
# Configuration
################
## Server
mqtt_server = "turris"
mqtt_port = 1883
# Core module minimal voltage
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
# ~/.moc/themes/monochrome_theme
# Add `Theme = monochrome_theme` to your ~/.moc/config
background = default default
frame = default default
window_title = default default
directory = default default
selected_directory = default default reverse
playlist = default default
selected_playlist = default default reverse
@dpup
dpup / FastMutex.js
Last active July 28, 2016 07:53
Code snippet for mutual exclusion lock in javascript.
FastMutex.prototype.runInLock = function (callback, opt_context) {
this._setX()
if (!this._isLockAvailable()) {
this._retry(callback, opt_context)
return
}
this._setY()
@nikcorg
nikcorg / berlin-jsconf-2014.md
Last active August 4, 2023 12:45
Slide decks of JSConf 2014
anonymous
anonymous / tmux.conf
Created September 9, 2014 18:35
vim friendly tmux configuration
#Prefix is Ctrl-a
set -g prefix C-a
bind C-a send-prefix
unbind C-b
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
#Mouse works as expected
@h0tw1r3
h0tw1r3 / rtc-i2c
Last active July 9, 2022 14:37
Initializing I2C RTC (DS3231) on Raspberry PI bootup with Systemd without recompiling the kernel or devicetree support.
# /etc/conf.d/rtc-i2c
#
# My chip is actually a ds3231n, but ds1307 driver works fine (ds3232 does not!)
#
CHIP="ds1307"
ADDRESS="0x68"
BUS="1"
@markgoodyear
markgoodyear / 01-gulpfile.js
Last active May 5, 2023 03:21
Comparison between gulp and Grunt. See http://markgoodyear.com/2014/01/getting-started-with-gulp/ for a write-up.
/*!
* gulp
* $ npm install gulp-ruby-sass gulp-autoprefixer gulp-cssnano gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache del --save-dev
*/
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
@XVilka
XVilka / TrueColour.md
Last active April 8, 2024 14:02
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@dshaw
dshaw / levelup.md
Last active November 17, 2022 14:52
Leveling-up on Node

Core Principals

  • Read lots of code.
  • Write lots of code.
  • Don’t be afraid to throw it away.
  • Don’t be afraid to share it.
  • Find your happy place writing tests.
    • You’ll probably spend more time writing tests and debugging than writing code. Embrace this. Make it a key part of your workflow.
    • Tests are one of the first things I read in a module. That and the example(s). Probably before API docs.
  • Don’t know where to start. Write some tests for a module you like. This benefits everyone.