Skip to content

Instantly share code, notes, and snippets.

@euske
euske / mckick.py
Created January 29, 2012 03:48
Minecraft kick server
#!/usr/bin/env python
# mckick.py - Minecraft kick server
#
# usage:
# $ python mckick.py 'server maintenance!'
#
import sys, struct, socket
def main(argv):
args = argv[1:]
@euske
euske / Keybase proof
Created October 31, 2017 23:32
Keybase proof
### Keybase proof
I hereby claim:
* I am euske on github.
* I am euske (https://keybase.io/euske) on keybase.
* I have a public key ASB-WZHzfT8Q3qyqWR4buSinp6Z7U_Or-8Shvi45aPmA4wo
To claim this, I am signing this object:
@euske
euske / setgamma.py
Created November 2, 2019 00:16
Change an image gamma with Pygame
import pygame
def set_gamma(img, gamma):
buf = img.get_buffer()
gmap = bytes( min(255, int(255*pow(i/255, gamma))) for i in range(256) )
buf.write(buf.raw.translate(gmap), 0)
return
img = pygame.image.load("in.jpg")
set_gamma(img, 0.5)
@euske
euske / colors.html
Last active February 2, 2020 01:46
Color Scheme for Slides
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Euske's Color Scheme</title>
<body>
<h1>Euske's Color Scheme</h1>
<table>
<tr>
<td>Low contrast</td>
<td bgcolor="#ffbbff"><code>#ffbbff</code></td>
<td bgcolor="#aaaaff"><code>#aaaaff</code></td>
[Background]
ImageFile=
MaskFile=
OverlayFile=
[Options]
HandsImage=
ShowMajorTicks=0
ShowMinorTicks=0
ShowTickNumbers=0
ShowCaption=1
@euske
euske / download_slack.py
Created March 8, 2020 07:19
Download Slack channel histories.
#!/usr/bin/env python
#
# Download Slack channel histories.
#
# Prerequisites:
# 1. Create a Slack app.
# 2. Give the app the following OAuth & Permissions:
# channels:read, channels:history, users.profile:read
# 3. Install the app & get OAuth token:
# "xoxp-..."
@euske
euske / precrecl.svg
Created April 14, 2020 06:38
False Positive and False Negative
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef int T;
typedef struct {
T* objs;
size_t nobjs;
size_t maxobjs;

ベイズ確率に関する覚え書き

「ベイズ確率」「事前確率」「事後確率」という用語がなんとなくピンとこない人に

まず、確率の主観性について

すべての確率モデルは主観的なものであり、 したがって確率も主観的な数値である。

たとえば、コインを投げて表が出る確率を考えてみよう。

@euske
euske / openssh-is-written-by-monkeys.md
Last active January 13, 2023 05:35
OpenSSL はサルが書いたに決まってる (OpenSSL is written by monkeys, by Marco Peereboom)