Skip to content

Instantly share code, notes, and snippets.

@is3ka1
is3ka1 / shoot_the_dragons_gate.py
Created December 16, 2023 16:55
Expected value of "Shoot the Dragon's Gate" game
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
def calculate_probabilities(card1, card2, num_decks=1):
deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] * int(4 * num_decks)
@is3ka1
is3ka1 / create_sqs_with_bucket_notif.py
Created March 22, 2023 04:01
Create AWS SQS with existed AWS S3 Bucket all-object-created event notification
import boto3
import json
import argparse
def create_sqs_queue_with_policy(
log_processor_user_name: str,
region_name: str,
s3_bucket_name: str,
sqs_queue_name: str,
@is3ka1
is3ka1 / whitelist.json
Last active August 5, 2022 12:50
whitelist.json
{
"id": "whitelist",
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"project_id": {
"type": "string",
@is3ka1
is3ka1 / docker-compose.yml
Last active January 6, 2021 11:18
GitLab self-host docker-compose example
# docker-compose.yml
web:
image: 'gitlab/gitlab-ee:latest'
restart: always
hostname: '$GITLAB_HOSTNAME'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://$GITLAB_HOSTNAME'
gitlab_rails['gitlab_shell_ssh_port'] = 2224
# Add any other gitlab.rb configuration here, each on its own line
@is3ka1
is3ka1 / CV_HW2.html
Last active April 8, 2020 14:37
College Homework for image processing
<!DOCTYPE html> <html lang=zh-tw><!--
Page saved with SingleFile
url: http://localhost:8888/notebooks/HW2.ipynb#
saved date: Wed Apr 08 2020 22:33:50 GMT+0800 (台北標準時間)
--><meta charset=utf-8>
<title>HW2 - Jupyter Notebook</title>
<meta http-equiv=X-UA-Compatible content="IE=edge">
<style>.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-n{cursor:n-resize;width:100%;left:0}.ui-slider{text-align:left}.ui-slider .ui-slider-handle{cursor:default;-ms-touch-action:none;touch-action:none}.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget-content{color:#222}.ui-widget-content .ui-state-default{background:#e6e6e6 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAGQEAAAAAAao4lEAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0T//xSrMc0AAAAHdElNRQfgCQ4NIgiW7vkhAAAATElEQVQ4y2N4l8fEwDCKRhF1EcOzZwzPjRie32Fi3MvEeIGJ8SsT4zcmRg4mRk4mxm9MjF+ZGB8zfGRmYljF8EmOiUF4wB08ioYEAgDUMBI63vAg
@is3ka1
is3ka1 / main.c
Created December 28, 2019 09:30
OS - Optimal Page Replacement
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CHUNK_SIZE 10
char *read_pages(size_t *len) {
size_t page_len = 0, pages_size = CHUNK_SIZE;
char *pages = (char *) calloc(pages_size + 1, sizeof(char));
@is3ka1
is3ka1 / serveo-server.sh
Last active December 29, 2019 10:25
docker command to Self-host a Serveo server
sudo docker run --network host -d \
taichunmin/serveo-server serveo \
-port=2222 \
-domain=isekai.tw \
-private_key_path=/root/.ssh/id_ed25519
@is3ka1
is3ka1 / reverse.c
Last active December 10, 2019 13:22
It's the homework of my college, implementing a function to reverse a simple one-way linked list. And I think this function I came up with was fun.
/*
.
.
.
typedef struct reg {
int ID;
int score;
struct reg *next;
} tReg;
@is3ka1
is3ka1 / Telegram export msg parser
Last active December 11, 2019 03:52
A script that transform messages exported from Telegram to CSV file with some config file.
just make it be the title