Skip to content

Instantly share code, notes, and snippets.

View Maki-Daisuke's full-sized avatar

Daisuke (yet another) Maki Maki-Daisuke

View GitHub Profile
package main
import (
"testing"
)
const ARRAY_SIZE = 100000
func mkArray() []int {
arr := make([]int, ARRAY_SIZE)
@Maki-Daisuke
Maki-Daisuke / digists_test.go
Created December 11, 2022 15:15
Incomplete Regular Expression engine implementation written by ChatGPT
package regexp
import "testing"
func TestCompile(t *testing.T) {
// 正規表現パターンをコンパイルする
re, err := Compile("^[0-9]+$")
if err != nil {
// コンパイルに失敗した場合はテスト失敗
t.Errorf("Compile failed: %v", err)
#!/usr/bin/zsh
if which zsh; then
chsh -s `which zsh`
else
echo "Run this script on Zsh!"
exit 1
fi
# Install zprezto
@Maki-Daisuke
Maki-Daisuke / main.go
Created July 9, 2022 03:30
fill-drive
package main
import (
"fmt"
"log"
"math"
"math/rand"
"os"
"time"
@Maki-Daisuke
Maki-Daisuke / concat_ts
Created May 12, 2022 06:27
Concatenate multiple .ts files into a single file using Ffmpeg
#!/usr/bin/env perl
use File::Temp qw/ tempfile /;
use File::Spec;
sub usage {
"Usage: $0 INPUT_FILE... OUTPUT_FILE"
}
my $ffmpeg = `which ffmpeg` || `which ffmpeg.exe` or die "Can't find ffmpeg\n\n@{[ usage ]}";
@Maki-Daisuke
Maki-Daisuke / dockerenv
Created January 7, 2015 01:34
MacでBoot2dockerを使うときのラッパーコマンド
#!/bin/sh
unset DYLD_LIBRARY_PATH ; unset LD_LIBRARY_PATH
mkdir -p ~/.boot2docker
if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
/usr/local/bin/boot2docker init
if /usr/local/bin/boot2docker up; then
export DOCKER_HOST=tcp://$(/usr/local/bin/boot2docker ip 2>/dev/null):2376
export DOCKER_CERT_PATH=/Users/maki/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
package main
import "fmt"
import "flag"
import "math/rand"
func main() {
var opt_no_alpha bool
var opt_no_digit bool
var opt_no_unsco bool
@Maki-Daisuke
Maki-Daisuke / random-string
Last active August 29, 2015 14:05
捨てパスワードとかランダムな文字列を生成するのに使ってるの
#!/usr/bin/env perl
use strict;
use Getopt::Std;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
sub HELP_MESSAGE {
my $fh = shift;
print $fh <<HELP;
@Maki-Daisuke
Maki-Daisuke / install.sh
Last active August 29, 2015 14:05
最近仕事の関係で、「\\ホスト名\ファイルパス」って書かれたメールが頻繁にやってくるようになったので、こんなone-linerをコマンド化した。 超はかどる。 ちなみに、OS X用。
#!/bin/sh -x
mkdir -p /usr/local/bin
cd /usr/local/bin
curl -L 'https://gist.githubusercontent.com/Maki-Daisuke/377eae4aaeb1110de183/raw/93a0072929084f6959565dc2516ecde34ad79f00/smbopen' > smbopen
chmod +x smbopen
@Maki-Daisuke
Maki-Daisuke / giploy
Last active December 27, 2015 14:19
カレントディレクトリ以下の Git の管理下にあるファイルのみを、指定したディレクトリにコピーするコマンドを実装してみました。 環境変数 GIPLOY_DEST でもコピー先を指定できるので、post-comit hook に登録することもできます。
#!/usr/bin/env perl
use strict;
use warnings;
our $VERSION = '0.01';
use constant DEBUG => (!!$ENV{DEBUG});
use Getopt::Std;