Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
#coding: utf-8
for x in range(1, 100):
flag = x > 1
for y in range(2, x+1):
if x % y == 0:
if x != y:
flag = 0
break
print('jojo!!' if flag else x)
cut -d":" -f1 /etc/passwd
cut -d":" -f7 /etc/passwd | grep -E '(sh$|in$)' | sort | uniq -c
grep -r '#!/bin/bash' /etc 2> /dev/null | sed 's/:.*$//' | while read line;do sed 's;#!/bin/bash;#!/usr/local/bin/bash;' $line > ~/hoge/$(basename $line) ;done
@ryoo14
ryoo14 / shell_arts4.sh
Last active August 29, 2015 13:57
シェル芸勉強会-第一回-問題4
awk '{print int($1/10)}' ages | sort -n | uniq -c | awk '{print $2*10"〜"$2*10+9,$1}'
@ryoo14
ryoo14 / shell_arts5.sh
Created March 19, 2014 12:30
シェル芸勉強会-第一回-問題5
seq 1 16 | awk '{if($1%15==0){print "FizzBuzz"}else if($1%3==0){print "Fizz"}else if($1%5==0){print "Buzz"}else{print $1}}' | tr '\n' ','
@ryoo14
ryoo14 / shell_arts2-1.sh
Created March 25, 2014 12:35
シェル芸勉強会第2回 問題1
ls [!a-zA-z]* | xargs rm
@ryoo14
ryoo14 / shell_arts2-2.sh
Created March 25, 2014 13:00
シェル芸勉強会第2回 問題2
expr $(cat nums | tr "\n" " " | sed 's/ $//' | sed 's/ / + /g')
@ryoo14
ryoo14 / shell_arts2-3.sh
Created March 25, 2014 13:22
シェル芸勉強会第2回 問題3
for i in a b ; do grep $i hoge | sort -k2n | tail -1; done
@ryoo14
ryoo14 / shell_arts2-4.sh
Created March 25, 2014 14:47
シェル芸勉強会第2回 問題4
sort -k1,1 num2 | yarr num=1 | sed 's/[ab] //g' | sed 's/ / + /g' | bc