Skip to content

Instantly share code, notes, and snippets.

@hector6872
hector6872 / arduino-display.ino
Last active December 2, 2018 12:19
display Arduino sketch
#include <U8g2lib.h>
// constructor
U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ 4, /* data=*/ 5);
// fake data
const String SYMBOL = "Bitcoin";
const String QUOTE = "USD";
const float PRICE = 20000.12345;
const float PERCENT_1h = -1.12345;
@hector6872
hector6872 / arduino-api-request.ino
Last active May 16, 2020 19:58
api-request Arduino sketch
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <ArduinoJson.h>
const char* SSID = "SSID";
const char* PASSWORD = "PASSWORD";
const String API_KEY = "API_KEY";
const char* SYMBOL = "BTC";
@hector6872
hector6872 / arduino-wifi-connect.ino
Last active December 2, 2018 11:48
wifi-connect Arduino sketch
// + info: https://arduino-esp8266.readthedocs.io/en/2.4.2/esp8266wifi/readme.html
#include <ESP8266WiFi.h>
const char* SSID = "SSID";
const char* PASSWORD = "PASSWORD";
void setup() {
Serial.begin(115200);
delay(100);
@hector6872
hector6872 / AdapterUpdatable.kt
Last active November 22, 2018 09:49
AdapterUpdatable for Kotlin (RecyclerView+DiffUtil)
interface AdapterUpdatable<TYPE> {
companion object {
private const val DEFAULT_UPDATE_CURRENT_LIST = false
}
val list: MutableList<TYPE>
fun update(
newList: List<TYPE>,
updateCurrentList: Boolean = DEFAULT_UPDATE_CURRENT_LIST,
@hector6872
hector6872 / CHANGELOG.md
Created October 16, 2018 15:24
CHANGELOG.md template

${project-name} Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

Changed

Added

Removed

@hector6872
hector6872 / extract-strings-android.sh
Created September 11, 2018 15:51
extract-strings-android script
#!/bin/bash
if [ -z "$1" ]
then
path="."
else
path=$1
fi
for filename in $path"/strings"*.xml; do
@hector6872
hector6872 / MarqueeAnimateView.kt
Last active August 17, 2018 15:16
MarqueeAnimateView for Android (Kotlin)
class MarqueeAnimateView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
companion object {
private const val STATE_START = 0
private const val STATE_STOP = 1
@hector6872
hector6872 / AutoMaxLinesTextView.kt
Last active August 13, 2018 09:10
AutoMaxLinesTextView for Android (Kotlin)
class AutoMaxLinesTextView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = android.R.attr.textViewStyle
) : AppCompatTextView(context, attrs, defStyleAttr) {
override fun onLayout(
changed: Boolean,
left: Int,
top: Int,
#!/usr/bin/env python
#################
## CREDENTIALS ##
#################
GH_PERSONAL_ACCESS_TOKEN = ''
BB_USERNAME = ''
BB_APP_PASSWORD = ''
BB_OAUTH_KEY = ''
@hector6872
hector6872 / gh2bb_migrate_cheapass.py
Created June 8, 2018 18:53
Migrate all your private github repos to bitbucket because you're CHEAP.
__author__ = 'schwa'
import os
import subprocess
import glob
from github import Github # pip install PyGithub
from bitbucket.bitbucket import Bitbucket # pip install --user bitbucket-api
GH_USERNAME = '[email protected]'
GH_PASSWORD = '1234'