Skip to content

Instantly share code, notes, and snippets.

View nakagami's full-sized avatar

Hajime Nakagami nakagami

View GitHub Profile
@nakagami
nakagami / darts_sample.cpp
Last active October 11, 2019 13:22
Darts (Double-ARray Trie System) http://chasen.org/~taku/software/darts/ sample code.
#include <iostream>
#include <darts.h>
// Darts http://chasen.org/~taku/software/darts/ sample code
int main (int argc, char **argv)
{
using namespace std;
const Darts::DoubleArray::key_type *str[] = { "ALGOL", "ANSI", "ARCO", "ARPA", "ARPANET", "ASCII" }; // same as char*

豚コレラと家畜衛生について

2019-09-10 BPLL #37 https://bpstudy.connpass.com/event/143999/

最近、「豚コレラ」という言葉を時々ニュースで聞くが、それが農家や農政に重大な危機であることがあまり知られてないのではないかと思う。 この危機を知ってもらいたい。

お前誰よ

@nakagami
nakagami / qrcode_view.py
Last active May 13, 2021 11:43
QR コードを png 画像として返す Django の view関数のコードスニペット
def qrsample(request):
import qrcode # pip install qrcode, pillow
from django.shortcuts import redirect
from django.http.response import HttpResponse
if request.method == "GET":
redirect('/')
qr = qrcode.QRCode(
error_correction=qrcode.constants.ERROR_CORRECT_H,
@nakagami
nakagami / mp4togif.py
Created July 2, 2019 08:00
mp4 to animation gif converter
#!/usr/bin/env python3
import sys
import imageio
"""
Convert mp4 to (animation) gif.
Reference: http://imageio.readthedocs.io/en/latest/examples.html#convert-a-movie
pip install imageio, imageio-ffmpeg
"""
@nakagami
nakagami / python_and_db2.rst
Last active July 13, 2020 03:43
Python database driver and Db2
@nakagami
nakagami / quickstartdjango.rst
Last active April 7, 2019 13:54
Quickstart with Django and pure python database drivers (2019-04-06)
package main
import (
"database/sql"
"fmt"
"log"
"github.com/jmoiron/sqlx"
_ "github.com/nakagami/firebirdsql"
)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elixir のプロジェクトに Pull Request を送った
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tokyo.ex #9 https://beam-lang.connpass.com/event/103873/
LT
2018-10-21
=============
自己紹介
@nakagami
nakagami / pg_scram_sha_256.py
Created September 24, 2018 22:01
PostgreSQL SCRAM-SHA-256 authentication
import hashlib
import hmac
import base64
import binascii
password = 'foobar'
client_nonce = '9IZ2O01zb9IgiIZ1WJ/zgpJB'
server = {
'r': '9IZ2O01zb9IgiIZ1WJ/zgpJBjx/oIRLs02gGSHcw1KEty3eY',
's': 'fs3IXBy7U7+IvVjZ',