Skip to content

Instantly share code, notes, and snippets.

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++
#!/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)
// ==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) {
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
#!/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 " "
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
@ryo1kato
ryo1kato / highlightRange.hs
Created August 15, 2014 15:32
highlightRange
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 [
--
-- 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:
<html>
<script TYPE="text/javascript" LANGUAGE="javascript">
window.resizeTo(100,200);
</script>
</html>
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