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
list=($(echo file?)) | |
max=${#l[@]} | |
i=0 | |
while (( i < max )) | |
do | |
j=0 | |
while (( j < max-i-1)) | |
do | |
echo ${list[$j]} ${list[$i]} | |
let j++ |
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/python | |
import sys | |
NR_LAYER = 10 | |
def get_n_plus_1(weights): | |
length = len(weights) | |
lower_weights = [[1 for col in range(length+1)] for row in range(length+1)] | |
print "---- %d -----" % len(weights) |
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
// ==UserScript== | |
// @name anti key-grabber | |
// @description Prevent web apps from capturing and muting vital keyboard shortcuts | |
// @grant none | |
// @version 1.1 | |
// ==/UserScript== | |
(function(){ | |
var isMac = unsafeWindow.navigator.oscpu.toLowerCase().contains("mac os x"); | |
unsafeWindow.document.addEventListener('keydown', function(e) { | |
if (e.keyCode === 116) { |
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
curl http://ekikara.jp/newdata/line/1301351.htm | nkf -u | grep '<span class="l"><a href="../station/[0-9]*.htm">' | sed -e 's/<[^>]*>//g' | tr -d ' ' | cut -d '(' -f 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
#!/bin/bash | |
n=$(<"$1") | |
nums=($n) | |
i=$(sort -nr $1|head -1) | |
while ((i--)) | |
do | |
for num in "${nums[@]}" | |
do | |
if [ $i -gt $num ]; then | |
echo -n " " |
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
cat result | while read t p; do t1=${t%-*}; t2=${t#*-}; p1=${p%-*}; p2=${t#*-}; t+=(t1 $t2); if (( p1 > p2 )); then echo ${t1} win; echo ${t2} lose; else echo ${t2} win; echo ${t1} lose; fi; done | sort | uniq -c |
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
import System.Console.ANSI | |
import qualified Data.ByteString.Lazy.Char8 as BS | |
import Text.Regex.PCRE | |
import Text.Regex.PCRE.ByteString | |
import Data.Int | |
hlCode = setSGRCode [SetColor Foreground Vivid Red] | |
hlReset = setSGRCode [Reset] | |
d = map BS.pack [ |
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
-- | |
-- hmlgrep - Haskell Multi-Line Grep | |
-- | |
{- | |
TODOs: | |
* Show filenames with --count option for multiple file input | |
* Implement match highlight | |
* FIX: '-' and '--' handling in optparse-applicative | |
* https://github.com/pcapriotti/optparse-applicative/pull/99 | |
* Use Boyer-Moore for non-regex patterns using stringsearch library: |
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
<html> | |
<script TYPE="text/javascript" LANGUAGE="javascript"> | |
window.resizeTo(100,200); | |
</script> | |
</html> |
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
import Control.Monad | |
import Data.Maybe | |
regexChars = "^$(|)[]{}.*" | |
regexCharsLast = "$)]}.*" | |
toPlainString' :: String -> String -> Maybe String | |
toPlainString' s [] = Just s | |
toPlainString' s (r:[]) = if r `elem` regexCharsLast | |
then Nothing |
OlderNewer