Skip to content

Instantly share code, notes, and snippets.


gasolin gasolin

View GitHub Profile
View gist:02244e9c2c78e4ea7c285305c16411bf

Install Android SDK on macOS

Install homebrew

brew cask install homebrew/cask-versions/adoptopenjdk8
brew cask install android-sdk
manuelbl /
Created Aug 3, 2019
ESP32 as Bluetooth Keyboard

ESP32 as Bluetooth Keyboard

With its built-in Bluetooth capabilities, the ESP32 can act as a Bluetooth keyboard. The below code is a minimal example of how to achieve it. It will generate the key strokes for a message whenever a button attached to the ESP32 is pressed.

For the example setup, a momentary button should be connected to pin 2 and to ground. Pin 2 will be configured as an input with pull-up.

In order to receive the message, add the ESP32 as a Bluetooth keyboard of your computer or mobile phone:

  1. Go to your computers/phones settings
  2. Ensure Bluetooth is turned on
kbumsik /
Last active Feb 12, 2021
Using iPad as a 2nd monitor on Linux with VNC.
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. - Bumsik Kim
# ----------------------------------------------------------------------------
# Configuration
WIDTH=1024 # 1368 for iPad Pro
tanaikech /
Last active Jun 11, 2020
Bitfinex API for Google Apps Script

Bitfinex API for Google Apps Script

This sample script is converted this sample script (javascript) to Google Apps Script. The point for converting is signature as shown in the following sample script.

  • At Bitfinex API, after "/api/" + apiPath + nonce + rawBody is encrypted using HMAC SHA-384, the data of byte array is converted to HEX.
    • In Google Apps Script, there is no the method for this.
    • The data which was encrypted by Utilities.computeHmacSignature() is the bytes array of the signed hexadecimal.
    • On the other hand, at this sample script for javascript, the data which was encrypted by crypto.createHmac('sha384', apiSecret).update(signature).digest('hex') is the string of the unsigned hexadecimal.

In order to achieve above, I made the method of bytesToHex().

unnikked /
Last active Jan 22, 2021
How to host your Telegram bot on Google App Script

Telegram Bot on Google App Script

This is the source code of one of my blog post. To read the full blog post please click here.

ebidel / feature_detect_es_modules.js
Last active Feb 3, 2021
Feature detect ES modules: both static import and dynamic import()
View feature_detect_es_modules.js
Complete feature detection for ES modules. Covers:
1. Static import: import * from './foo.js';
2. Dynamic import(): import('./foo.js').then(module => {...});
Thanks to @_gsathya, @kevincennis, @rauschma, @malyw for the help.
heygrady /
Last active Feb 3, 2021
Redux containers: mapDispatchToProps

Redux containers: mapDispatchToProps

This document details some tips and tricks for creating redux containers. Specifically, this document is looking at the mapDispatchToProps argument of the connect function from [react-redux][react-redux]. There are many ways to write the same thing in redux. This gist covers the various forms that mapDispatchToProps can take.

ncochard /
Last active Feb 23, 2021
The correct way to compile ES6 using babel...

When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:

  1. Is it going to be used as a dependency to a nodejs application that is not bundled? (e.g. command line utilities)
  2. Is it going to be used as a dependency to a nodejs application that is bundled? (e.g. AWS Lambdas)
  3. Is it going to be used as a dependency to a browser application (always bundled)?.
  • In cases 2) and 3) you want to allow for tree shaking.
  • In cases 1) and 2) you want to benefit from the "ES6"/"ES next" features supported natively by nodejs.
  • In case 3) you also want to benefit from the native support of "ES6" from your browser.
sqren / determine-changed-props.js
Last active Jan 20, 2021
Determine which props causes React components to re-render
View determine-changed-props.js
import React, { Component } from 'react';
export default function withPropsChecker(WrappedComponent) {
return class PropsChecker extends Component {
componentWillReceiveProps(nextProps) {
.filter(key => {
return nextProps[key] !== this.props[key];
.map(key => {
joelash / app.js
Last active Feb 5, 2021
React Native Detect Backgrounding/Foregrounding
View app.js
import React from 'react';
import {
} from 'react-native';
import Expo from 'expo';
class App extends React.Component {
constructor(props) {