Skip to content

Instantly share code, notes, and snippets.

View TrsNium's full-sized avatar
🦾
Focusing

Trs TrsNium

🦾
Focusing
View GitHub Profile
@tbutts
tbutts / tmux-migrate-options.py
Last active February 29, 2024 08:11
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
#!/usr/bin/env python
# vim: set fileencoding=utf-8
#
# USAGE:
# Back up your tmux old config, run the script and redirect stdout to your conf
# file. Example:
#
# $ cp ~/.tmux.conf ~/.tmux.conf.orig
# $ python ./tmux-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf
#
@GINK03
GINK03 / keras-seq2seq.md
Last active December 27, 2019 01:41
keras-seq2seq.md

KerasでSeq2Seqをやる

KerasでSeq2Seq

Seq2Seqといえば、TensorFlowでの実装が有名で、英語とフランス語の大規模コーパスを使ってやるものが、よくチューニングされており便利です
しかし、この翻訳のタスクに最適化されており、一般的なものと言い難い感じで任意のタスクに変換して利用する際に少々不便を感じていました。 (TensorFlowのものは、自分で改造するにしても人に説明する際も、ちょっと面倒)

今回、Kerasで実装して、ある程度、うまく動作することを確認しました

ネットワークの説明

@fchollet
fchollet / classifier_from_little_data_script_3.py
Last active September 13, 2023 03:34
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@tasdikrahman
tasdikrahman / python_tests_dir_structure.md
Last active June 30, 2024 00:15
Typical Directory structure for python tests

A Typical directory structure for running tests using unittest

Ref : stackoverflow

The best solution in my opinion is to use the unittest [command line interface][1] which will add the directory to the sys.path so you don't have to (done in the TestLoader class).

For example for a directory structure like this:

new_project

├── antigravity.py

@trkrameshkumar
trkrameshkumar / db.go
Created September 6, 2015 07:19
Get get number of rows using sql in golang
package main
import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
)
const (
DB_USER = "ramesh"
@kazuho
kazuho / markdown.md
Last active July 30, 2019 09:14
Linuxカーネルのreadahead、うまく動いてないケースがあるのかも

大きなテキストファイルをawkで処理するときにcatで投げ込むと速い理由のような事象が発生する原因についての推察。

自信はあまりない!

Linuxカーネルのreadahead実装についての理解

  • __do_page_cache_readaheadは、次にreadaheadを実行すべきページについてのみReadaheadフラグをたてる
  • 次にreadaheadを実行すべきページ「以降の全てのページ」ではない
  • do_generic_file_readはReadaheadフラグの立っているページをreadするタイミングでpage_cache_async_readaheadを呼ぶ
  • page_cache_async_readaheadはBDI_sync_congestedが立っている場合はreadaheadしない
@ngauthier
ngauthier / timeout_and_tick.go
Created February 10, 2015 18:14
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout:
@jprjr
jprjr / Dockerfile
Created November 26, 2013 23:09
Setting up pyenv in docker
FROM tianon/centos-null:5.9
RUN rpm -i http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
RUN yum -y update
RUN yum -y install gcc git curl make zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl openssl-devel
RUN useradd -m python_user
RUN ln -s /proc/self/fd /dev/fd
@sixtenbe
sixtenbe / analytic_wfm.py
Last active May 27, 2024 01:24 — forked from endolith/peakdet.m
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See