This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use anyhow::Context as _; | |
use anyhow::Result; | |
use chrono::{FixedOffset, TimeZone, Utc}; | |
use lambda_runtime::{error::HandlerError, lambda, Context}; | |
use log::info; | |
use reqwest::{blocking::Client, header::CONTENT_TYPE}; | |
use serde::{Deserialize, Serialize}; | |
const NANANIJI_GENERATOR_URL: &'static str = | |
"https://xxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/beta/"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// serde = "1.0" | |
// serde_derive = "1.0" | |
// serde_json = "1.0" | |
use serde::{Deserialize, Deserializer}; | |
use serde_derive::Deserialize; | |
#[derive(Debug, Deserialize)] | |
struct Hoge { | |
#[serde(deserialize_with="deserialize_option")] | |
val: Option<u64>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::env; | |
use serde_derive::Deserialize; | |
use anyhow::Result; | |
const EMAIL: &'static str = "ikamat.kmr@gmail.com"; | |
const SUMMARY_URL:&'static str = "https://api.track.toggl.com/reports/api/v2/summary"; | |
#[tokio::main] | |
async fn main() -> Result<()> { | |
let toggl_token = env::var("TOGGL_TOKEN")?; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "komori/unique_function.hpp" | |
#include "gtest/gtest.h" | |
namespace { | |
constexpr const int kMagicNumber1 = 0x334; | |
constexpr const int kMagicNumber2 = 0x668; | |
int func1(void) { | |
return kMagicNumber1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define A (1) | |
#define B ((uint8_t)2) | |
#define STRIP_PRN(x) IDENTITY x | |
#define IDENTITY(x) x | |
#define DELETE_BLOCK(x) DELETE_ARG x | |
#define DELETE_ARG(x) | |
STRIP_PRN(A) | |
DELETE_BLOCK(STRIP_PRN(B)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define A 0 | |
#define B 1 | |
#define CFG_1_MODE A | |
#define CFG_2_MODE B | |
#define CFG_3_MODE A | |
#define EXPAND(i) IMPL_TMP(CFG_##i##_MODE)(i) | |
#define IMPL_TMP(mode) IMPL_CAT(mode) | |
#define IMPL_CAT(mode) IMPL_##mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <inttypes.h> | |
uint8_t event1(int32_t* param) { | |
uint8_t data = (uint8_t)*param; | |
printf("%"PRId8"\n", data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import copy, deepcopy | |
import pickle | |
import timeit | |
pickle_copy = lambda l: pickle.loads(pickle.dumps(l, -1)) | |
case = 5 | |
if case == 1: | |
## case 1: integer list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
from random import shuffle | |
from queue import PriorityQueue | |
import time | |
import _pickle as cPickle | |
class Card(): | |
TEXT2NUM = { | |
"6": 6, "7": 7, "8": 8, "9": 9, "0": 10, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
from ortools.sat.python import cp_model | |
BOARD_SIZE = 9 | |
WIDTH = HEIGHT = BOARD_SIZE | |
PIECETYPES = ['p', 'n', 's', 'g', 'k', 'l', 'r', 'b', 'q', '_'] | |
# 0:up, 1:down, 2:left, 3:right, 4:upleft, 5:upright, 6:downleft, 7:downright, | |
# 8:knightleft, 9:knightright | |
DI = [-1, 1, 0, 0, -1, -1, 1, 1, -2, -2] | |
DJ = [0, 0, -1, 1, -1, 1, -1, 1, -1, 1] |