This file contains 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 compiler.ast import flatten | |
flatten([0, [1, 2], [3, 4, [5, 6]], 7]) |
This file contains 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 itertools import permutations | |
[i for i in permutations(range(0, 2))] |
This file contains 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 | |
current_dir=$(cd $(dirname $0) && pwd) | |
export THEOS=/opt/theos | |
# clone theos.git | |
cd /opt | |
git clone git://github.com/DHowett/theos.git | |
# clone iphoneheaders.git | |
cd $THEOS |
This file contains 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 collections import Counter | |
my_dict = {'F': 200, 'G': 500, 'D': 100, 'E': 400, 'B': 200, 'C': 300, 'A': 500} | |
# duplicate values list | |
dup_list = [k for k, v in Counter(my_dict.values()).items() if v > 1] # [200, 500] | |
print({k: v for k, v in my_dict.items() if v in dup_list}) # {'F': 200, 'G': 500, 'B': 200, 'A': 500} |
This file contains 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 python | |
# -*- coding: utf-8 -*- | |
# if文禁止 | |
print([i%j == 0 for i, j in zip([int(input())]*3, [4, 100, 400])].count(True) % 2 == 1) | |
# if文・for文禁止 | |
print(sum(list(map(lambda x, y: x%y == 0, [int(input())]*3, [4, 100, 400]))) % 2 == 1) |
This file contains 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
# output: 1 - 100 | |
# don't use "if" and "for" | |
print "\n".join(map(lambda x: [["FizzBuzz", "Fizz"], ["Buzz", str(x)]][bool(x%3)][bool(x%5)], range(1, 101))) |
This file contains 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 | |
ok=true | |
for file in $(git diff --name-only --cached | grep .mqh); do | |
if [ "`nkf --guess $file | grep 'Shift_JIS'`" ]; then | |
: | |
else | |
ok=false | |
echo "$file is not Shift_JIS" | |
fi |
This file contains 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
LIBEVENT_VERSION="2.1.12-stable" | |
TMUX_VERSION="3.2a" | |
sudo yum install -y gcc kernel-devel make ncurses-devel openssl-devel | |
curl -LOk https://github.com/libevent/libevent/releases/download/release-${LIBEVENT_VERSION}/libevent-${LIBEVENT_VERSION}.tar.gz | |
tar -xf libevent-${LIBEVENT_VERSION}.tar.gz | |
cd libevent-${LIBEVENT_VERSION} | |
./configure --prefix=/usr/local | |
make -j4 |
This file contains 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
PECO_VERSION="v0.5.11" | |
curl -LOk https://github.com/peco/peco/releases/download/${PECO_VERSION}/peco_linux_amd64.tar.gz | |
tar -xf peco_linux_amd64.tar.gz | |
sudo chmod +x peco_linux_amd64/peco | |
sudo cp peco_linux_amd64/peco /usr/local/bin/peco |
This file contains 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
$windows_module_installer = "TrustedInstaller" | |
$windows_update = "wuauserv" | |
Get-Service -Name $windows_module_installer | |
Get-Service -Name $windows_update | |
$answer = (Read-Host "Windows Update 有効化/無効化 (e/d)") | |
if($answer -eq "e"){ | |
Set-Service -Name $windows_module_installer -StartupType "Manual" |
OlderNewer