Skip to content

Instantly share code, notes, and snippets.

Working from home

Ohkubo KOHEI kuboon

Working from home
View GitHub Profile
View mtx.c
#include <stdio.h>
#include <assert.h>
#define N 16
#define K 8
#include "global.h"
#include "chash.c"
#include "inv_mat.c"
typedef struct {

Keybase proof

I hereby claim:

  • I am kuboon on github.
  • I am kuboon ( on keybase.
  • I have a public key ASB-DFiIjV4i7r3896Wm4qQEdU_9djhLMFZ3j2t1xZCcgQo

To claim this, I am signing this object:

kuboon /
Created Oct 6, 2020
install gcloud on Ubuntu
#!/bin/env sh
sudo apt install apt-transport-https ca-certificates gnupg
curl | sudo apt-key --keyring /usr/share/keyrings/ add -
echo "deb [signed-by=/usr/share/keyrings/] cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt update && sudo apt install google-cloud-sdk
kuboon / getSelectionWithAlt.ts
Last active Oct 10, 2020
document.getSelection with img.alt text
View getSelectionWithAlt.ts
function isImg(node: Node):node is HTMLImageElement{
return node.nodeName==='IMG'
function selectionToFragment(){
const s = document.getSelection()
const r = s!.getRangeAt(0)
return r.cloneContents()
function getTextFromFragment(f: DocumentFragment) {
const walker = document.createTreeWalker(f, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT,
kuboon /
Created Sep 17, 2020
HTML based GUI app with python flask
from flask import Flask,request
app = Flask(__name__)
def index():
return "<form method='post' action='form'><input name='val'><button type='submit'>send</button></form>"
@app.route('/form', methods=['POST'])
def form():
View drive.ts
const res = await drive.permissions.create({
requestBody: {
role: 'writer',
type: 'user',
emailAddress: ''
View jsonComp.ts
export function comp(x: any, y: any): boolean {
if (typeof x === 'object') {
const keys = Object.keys(x)
if (keys.length !== Object.keys(y).length) return false
return keys.every(k=>comp(x[k], y[k]))
return x === y
const a = {a:1,b:2,c:{a:1,b:3}}
kuboon / enc_dec.ts
Last active Jun 12, 2020
Typescript nodejs stdlib enc/dec sample
View enc_dec.ts
import * as crypto from 'crypto'
import assert from 'assert'
const ivKey = 'randomString1-fah3f;aklajr'
const initialVec = Buffer.alloc(16, 0)
kuboon / sample.ts
Created Apr 22, 2020
Typescript: constructor with named arguments
View sample.ts
class ConstructorArgs {
namespace: string[] = ["default", "values"]
class Base extends ConstructorArgs {
constructor(opts: ConstructorArgs = new ConstructorArgs) {
Object.assign(this, opts)
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Dumber Gist</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<base href="/">
Dumber Gist uses dumber bundler, the default bundle file
You can’t perform that action at this time.