I hereby claim:
- I am amadanmath on github.
- I am amadan (https://keybase.io/amadan) on keybase.
- I have a public key ASAj05NMOoBTV-DRI03KNrjzXucunCbptVKRPX8vU3w75Qo
To claim this, I am signing this object:
# Written against Ruby 1.9.2 | |
# Hole #1: FizzBuzz | |
# I accidentally saw Cyrus's solution before trying my own, so no attempt | |
# Hole #2: Caesar Cipher | |
# Works only for `[a-zA-Z]*` | |
def caesar(f,x) | |
f.each_char.map{|c|t=c.ord+x;(t-1)&31>25&&t+=x<0?26:-26;t.chr}*'' | |
end |
// ==UserScript== | |
// @name KaTeX for Gists | |
// @author Goran Topić | |
// @homepage http://github.com/amadanmath/ | |
// @include *://gist.github.com/* | |
// @version 0.1.1 | |
// @updateURL https://gist.github.com/amadanmath/6eaf4cc850f38b78562f/raw/KaTeX_for_Gists.user.js | |
// @downloadURL https://gist.github.com/amadanmath/6eaf4cc850f38b78562f/raw/KaTeX_for_Gists.user.js | |
// @description Shows LaTeX in <tt> tags on Github Gist pages | |
// ==/UserScript== |
#!/usr/bin/env ruby | |
input = [ | |
[1,0,0,0,1,0,0,0,0,1,0,0,0,0,0], | |
[1,0,0,0,1,0,0,0,0,0,0,0,0,0,0], | |
[1,0,0,0,1,0,0,0,0,1,0,0,0,0,0], | |
[1,0,1,0,1,0,0,0,0,0,0,0,0,0,0], | |
[0,0,0,0,0,0,1,1,0,1,0,0,0,0,0], | |
[0,0,0,0,0,0,0,1,0,0,0,0,1,0,0], | |
[0,0,0,0,0,0,1,0,0,0,0,1,0,0,0], |
I hereby claim:
To claim this, I am signing this object:
from langdetect.detector_factory import DetectorFactory, PROFILES_DIRECTORY | |
import os | |
def get_factory_for(langs): | |
df = DetectorFactory() | |
profiles = [] | |
for lang in ['en', 'ru', 'pl']: | |
with open(os.path.join(PROFILES_DIRECTORY, lang), 'r', encoding='utf-8') as f: | |
profiles.append(f.read()) | |
df.load_json_profile(profiles) |
#!/bin/bash | |
# https://stackoverflow.com/a/78062608/240443 | |
# Inspired by glenn jackman's awesome '$(NF-1) == "" {$(NF-1) = $NF} {NF--} 1' trick | |
file1=$1 | |
file2=$2 | |
key=${3:-name} | |
sep=${4:-|} | |
key1=$(head -1 "$file1" | awk -v FS="$sep" -v key="$key" '{ for (i = 1; i <= NF; i++) if ($i == key) print i }') |