Skip to content

Instantly share code, notes, and snippets.

View karno's full-sized avatar
🤔

Karno karno

🤔
View GitHub Profile
11 12 13 14
21 22 23 24
31 32 33 34
a b c d
11 12 13 14
21 22 23 24
31 32 33 34
use super::config;
use config::*;
use futures::future::TryFutureExt;
use std::iter::Iterator;
use std::path;
pub static DEFAULT_ID: u64 = 0;
pub async fn load_or_init_api_key(token_file: &str) -> Result<ApiKey, ConfigError> {
let token_path = path::Path::new(token_file);
pub async fn load_or_init_api_key(token_file: &str) -> Result<ApiKey, ConfigError> {
let token_path = path::Path::new(token_file);
if token_path.exists() {
let token = ApiKey::load(token_path)?;
match ApiKey::load(token_path) {
Ok(token) => Ok(token),
Err(e) => {
eprintln!("failed to read application token file:");
eprintln!("{}", e);
Err(e)
pub async fn load_or_init_api_key(token_file: &str) -> Result<ApiKey, ConfigError> {
let token_path = path::Path::new(token_file);
if token_path.exists() {
let token = ApiKey::load(token_path)?;
match ApiKey::load(token_path) {
Ok(token) => Ok(token),
Err(e) => {
eprintln!("failed to read application token file:");
eprintln!("{}", e);
Err(e)
@karno
karno / SushiSlot.tsx
Created October 16, 2019 16:36
sushiro gacha test
import React, { useState, useEffect } from 'react';
import SushiInfo from './common/SushiInfo';
import './SushiSlot.css';
interface SushiSingleSlotProps {
sushies: SushiInfo[],
sushi: SushiInfo,
delay: number,
}
@karno
karno / file0.txt
Created July 26, 2019 08:30
GitHubへのgit clone/pull/push時にSSL証明書まわりでエラーが出るときの本当に正しい対処法 ref: https://qiita.com/karno/items/5ad5006a4912617d2610
$ git clone https://github.com/karno/Cadena
Cloning into 'Cadena'...
fatal: unable to access 'https://github.com/karno/Cadena/': SSL certificate problem: self signed certificate in certificate chain
exit status 128
@karno
karno / ssrl.py
Created January 7, 2019 07:07
fetch menus from sushiro
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SSRL: SuShiRo menu List acquisitor script.
import datetime
import json
import re
import sys
@karno
karno / main.rs
Last active November 6, 2018 16:44
bmp2gray
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::io::{BufReader, BufWriter, Read, Result, SeekFrom, Write};
use std::mem::transmute;
trait ToInt<T> {
fn to_int(&self) -> T;
}
@karno
karno / main.rs
Created July 20, 2017 14:23
failing compile
#[derive(Debug)]
struct Point {
x: f64,
y: f64,
}
impl std::ops::Add for Point {
type Output = Point;
fn add(self, rhs: Point) -> Point {
Point::new(self.x + rhs.x, self.y + rhs.y)