Skip to content

Instantly share code, notes, and snippets.

@asukakenji
asukakenji / gist:248507844bdc2705c74af31223b47a38
Created September 1, 2016 10:39
Booting Ubuntu from UEFI Shell
FS0:\EFI\ubuntu\shimx64.efi
func (bt *BlinkyTape) playPattern(p Pattern, delay time.Duration) {
bt.clear()
L:
for _, frame := range p {
bt.setFrame(frame)
if err := bt.render(); err != nil {
log.Fatalf("render error: %s\n", err)
}
func (bt *BlinkyTape) animation(p Pattern, repeat int, delay time.Duration) {
bt.status = Running
innerLoop := func() bool {
select {
case <-bt.stop:
return false
default:
go bt.playPattern(p, delay)
<-bt.next
func (bt *BlinkyTape) animation(p Pattern, repeat int, delay time.Duration) {
bt.status = Running
L:
for i := 0; repeat < 0 || i < repeat; i++ {
select {
case <-bt.stop:
break L
default:
go bt.playPattern(p, delay)
@asukakenji
asukakenji / try_shiny.go
Created July 31, 2017 17:18
Shortest GUI program written in Golang. It displays a window and exits after 5 seconds.
// Shortest GUI program written in Golang.
// It displays a window and exits after 5 seconds.
package main
import (
"time"
"golang.org/x/exp/shiny/driver"
"golang.org/x/exp/shiny/screen"
)
@asukakenji
asukakenji / docker-pull-golang.sh
Last active November 23, 2018 08:27
Pulling (downloading) all official releases (versions) of Go (Golang) images from Docker Hub
#!/bin/bash
# The first release available is golang:1.2.0
major=1
minor=2
patch=0
while true
do
while true
@asukakenji
asukakenji / solving_sin_z_equals_2.ipynb
Last active September 29, 2019 03:01
Solving sin(𝑧)=2 (Trigonometric Equations with Complex Numbers)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asukakenji
asukakenji / deriving_trigonometry_formulae.ipynb
Last active October 1, 2019 16:36
Deriving Trigonometry Formulae
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asukakenji
asukakenji / try_shiny_2.go
Last active February 17, 2020 01:19
Shortest GUI program written in Golang. It displays a window and exits when the "close" button of the window is clicked.
// Shortest GUI program written in Golang.
// It displays a window and exits when the "close" button of the window is clicked.
package main
import (
"golang.org/x/exp/shiny/driver"
"golang.org/x/exp/shiny/screen"
// Despite that the package names have a "mobile" prefix,
// these packages works on desktop.
@asukakenji
asukakenji / main.swift
Created November 29, 2018 11:31
Minimal Swift 4.2 GUI Application without Xcode
import AppKit
let app = NSApplication.shared
app.setActivationPolicy(.regular)
let window = NSWindow(
contentRect: NSMakeRect(0, 0, 640, 480),
styleMask: [.titled, .closable],
backing: .buffered,
defer: true