This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <random> | |
#include <array> | |
#include <string> | |
using namespace std; | |
enum { | |
ZUN, | |
DOKO, | |
}; | |
int main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import * | |
seed() | |
count = 0 | |
tbl = ("ズン", "ドコ") | |
while count < 5: | |
rnd = randrange(2) | |
if count < 4: | |
if rnd == 0: | |
count += 1 | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Linux: 原則rootで実行してください | |
# Windows: Git Bashなどで実行してください | |
sed -i -e '/luajitlatex/s/^ *#! *//' `kpsewhich fmtutil.cnf` || exit $? | |
fmtutil-sys --byfmt luajitlatex || exit $? | |
case `uname | tr [:upper:] [:lower:]` in | |
*msys*) | |
break;; | |
*cygwin*) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Bash | |
for i in {1..100}; do # Don't have to use `seq` | |
# There are ((...))) and [[...]]] (didn't use this time) in Bash | |
if ((i % 15 == 0)); then | |
echo Fizz Buzz | |
elif ((i % 3 == 0)); then | |
echo Fizz | |
elif ((i % 5 == 0)); then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
//1行の入力を受け付ける関数。 | |
//字数無制限。 | |
//-1→失敗 0→正常 1→入力なし | |
//利用方法: gets_line(&pt) (pt: char* (=NULL)) | |
//使用したポインタは必ず開放してください | |
#define GETS_LINE_INITIAL_LEN 64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$wsl_state = (Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux).State | |
if ($wsl_state) { | |
Write-Output "WSL has already been enabled." | |
exit(0) | |
} | |
if ($wsl_state -eq $null) { | |
Write-Output "WSL cannot be enabled because it doesn't exist on your PC. Update it to the latest Windows 10." | |
exit(1) | |
} | |
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2018 Tatsunori Uchino | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE O |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ((Get-Command nvim -ErrorAction Ignore)) { | |
if (-not (Get-Command vim -ErrorAction Ignore)) { | |
Set-Alias vim nvim | |
} | |
if (-not (Get-Command vi -ErrorAction Ignore)) { | |
Set-Alias vi vim | |
} | |
if (-not (Get-Command gvim -ErrorAction Ignore)) { | |
Set-Alias gvim nvim-qt | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prompt() { | |
$return_code = $? | |
$domain_and_name = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name | |
$absolute = (Get-Location).Path | |
$esc = "$([char]27)" | |
$reset = $esc + "[0m" | |
$nas_prefix = 'Microsoft.PowerShell.Core\FileSystem::' | |
$is_root = (New-Object Security.Principal.WindowsPrincipal ([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
$prompt_sign = if ($is_root) { Write-Output '#' } else { Write-Output '$' } | |
return "${esc}[1;36mPS${reset}" ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 利用法: | |
# curl -LsSf https://gist.github.com/tats-u/89a20f60c11ef86b32deeaf4a6e3cc91/raw/ubuntu_use_jp_mirror_repo.sh | sudo bash | |
# | |
# 主にWSL・Docker上のUbuntuが利用対象です | |
# (ベアメタルや各種VMにインストールしたUbuntuはすでにリポジトリが日本ミラーになっているため) | |
sed -i '/^deb/s@://archive\.ubuntu\.com@://jp.archive.ubuntu.com@' /etc/apt/sources.list |
OlderNewer