Skip to content

Instantly share code, notes, and snippets.

View espresso3389's full-sized avatar

Takashi Kawasaki espresso3389

View GitHub Profile
#include <ESP8266WiFi.h> // or WiFi.h for ESP32
#include <WiFiClientSecure.h>
#include <map>
const char* const GOOGLE_APIKEY = "gggggggggggggggggggggggggggggg";
const char* const SLACK_TOKEN = "ssssssssssssssssssssssssssssssssssss";
void setup()
{
pinMode(14,OUTPUT);
@espresso3389
espresso3389 / legendOfHeroes.dart
Created June 16, 2019 21:07
Legend of Heroes
import 'package:flutter/material.dart';
/// The class controls every [Hero] widget has it's own name.
/// If the code generates [Hero.tag] by some model derived algorithm,
/// especially in list widgets such as [ListView.builder], the tag may
/// conflict in some case. The class has internal tag list and if same tag
/// is used twice, it does not insert [Hero] in that case.
/// ```dart
/// Widget build(BuildContext context) {
/*
* The MIT License
*
* Further resources on the MIT License
* Copyright 2018 Cuminas Corporation/@espresso3389
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
@espresso3389
espresso3389 / abortcopytest.mjs
Created March 3, 2018 09:19
Aborting file copy on node.js
'use strict';
import fs from 'fs-extra';
try {
const srcfn = 'sorucefile';
const dstfn = 'tmp.bin';
const src = fs.createReadStream(srcfn);
const dst = fs.createWriteStream(dstfn);
@espresso3389
espresso3389 / keyboard-ja-jp.reg
Created January 26, 2018 03:54
Registry patch to change keyboard layout to 109-ja-jp
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters]
"LayerDriver JPN"="kbd106.dll"
"OverrideKeyboardIdentifier"="PCAT_106KEY"
"OverrideKeyboardType"=dword:00000007
"OverrideKeyboardSubtype"=dword:00000002
@espresso3389
espresso3389 / keyboard_en_us.reg
Created January 26, 2018 03:54
Registry patch to change keyboard layout to 101-en-us
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters]
"LayerDriver JPN"="kbd101.dll"
"OverrideKeyboardIdentifier"="PCAT_101KEY"
"OverrideKeyboardType"=dword:00000007
"OverrideKeyboardSubtype"=dword:00000000
@espresso3389
espresso3389 / admin_powershell.reg
Created January 26, 2018 03:52
Registry patch to enable powershell with administrative privilege
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="PowerShell ウィンドウをここに開く(管理者)"
"Extended"=""
"NoWorkingDirectory"=""
"ShowBasedOnVelocityId"=dword:00639bc8
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="powershell.exe -noexit -command Set-Location -literalPath '%V'"
@espresso3389
espresso3389 / guimode.sh
Created January 10, 2018 15:56
Preparing for using framebuffer directly on Raspbian
#!/bin/sh
# The script requires root permission or sudo.
# Switch to GUI mode (Alt-7)
chvt 7
# Disable screen blank (screen saver)
setvesablank off
# Disable cursor blinking on the screen top
echo 0 > /sys/class/graphics/fbcon/cursor_blink
@espresso3389
espresso3389 / normal_loop.cpp
Created December 16, 2017 15:04
Random number sequence
int main()
{
std::mt19937 r;
for (;;)
std::printf("%d\n", r());
}
@espresso3389
espresso3389 / coroutine_test.cpp
Created December 16, 2017 15:02
Evaluating coroutine performance on Visual C++
#include <cstdio>
#include <random>
#include <experimental/generator>
auto random()
{
std::mt19937 r;
for (;;)
co_yield r();
}