Skip to content

Instantly share code, notes, and snippets.

View atotto's full-sized avatar
🌏
Working from home

Ato Araki atotto

🌏
Working from home
View GitHub Profile
@atotto
atotto / ssh.go
Last active August 11, 2023 02:43
golang ssh terminal client
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
@atotto
atotto / firebase_sign_in_with_custom_token.go
Created April 11, 2019 03:35
Firebase SignInWithCustomToken
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
@atotto
atotto / pomodoro-timer.ino
Created April 4, 2019 14:07
my pomodoro timer
#include <avr/sleep.h>
const int timerOutPin = 11;
#define analogOutMax 235
void timer() {
unsigned long startTime = millis();
long elapsedTime = 0;
int outputValue = 0;
@atotto
atotto / firebase_idtoken_test.go
Created November 27, 2018 06:11
Firebase generate user id token
package hoge
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
@atotto
atotto / influxdb-gce.cloud.cfg
Created May 12, 2018 08:24
influxdb gce deploy with cloud-init
#cloud-config
#see: https://cloud.google.com/container-optimized-os/docs/how-to/create-configure-instance
write_files:
- path: /etc/systemd/system/influxdb.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Start influxdb docker container
@atotto
atotto / setup-jx.sh
Created March 28, 2018 00:48
setup jenkins-x
#!/bin/sh
set -e
VERSION=$(curl -s https://api.github.com/repos/jenkins-x/jx/releases/latest | jq '.tag_name' -r)
curl -sL https://github.com/jenkins-x/jx/releases/download/$VERSION/jx-linux-amd64.tar.gz | tar xzv
sudo mv jx /usr/local/bin
@atotto
atotto / lsusb.go
Created December 20, 2017 05:12
lsusb (golang)
package main
import (
"fmt"
"log"
"github.com/google/gousb"
"github.com/google/gousb/usbid"
)
@atotto
atotto / compute.go
Last active May 9, 2021 00:46
golang testing pattern
package calc
import (
"go/token"
"go/types"
)
func Compute(expr string) (string, error) {
tv, err := types.Eval(token.NewFileSet(), types.NewPackage("main", "main"), token.NoPos, expr)
if err != nil {
@atotto
atotto / dash_button_server.go
Created July 17, 2017 08:51
Amazon Dash Button Server
package main
import (
"log"
"net"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
)
@atotto
atotto / mqtt_test.go
Created January 25, 2017 09:02
github.com/eclipse/paho.mqtt.golang example
package mqtt_test
import (
"sync"
"testing"
mqtt "github.com/eclipse/paho.mqtt.golang"
)
func TestMqttPubSub(t *testing.T) {