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
129c129 | |
< for i in 0..32 as usize { | |
--- | |
> for i in 0..8 as usize { |
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
set main-view-date = custom | |
set main-view-date-format = "%Y-%m-%d" | |
set line-graphics = utf-8 | |
set git-colors = no | |
# KEY-BINDING | |
# ref: https://github.com/jonas/tig/wiki/Bindings | |
bind main ! ?git revert %(commit) | |
bind main + ?git commit --amend |
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
--- TLP 1.4.0-beta.1 -------------------------------------------- | |
+++ Configured Settings: | |
defaults.conf L0004: TLP_ENABLE="1" | |
defaults.conf L0005: TLP_WARN_LEVEL="3" | |
defaults.conf L0006: TLP_PERSISTENT_DEFAULT="0" | |
defaults.conf L0007: DISK_IDLE_SECS_ON_AC="0" | |
defaults.conf L0008: DISK_IDLE_SECS_ON_BAT="2" | |
defaults.conf L0009: MAX_LOST_WORK_SECS_ON_AC="15" | |
defaults.conf L0010: MAX_LOST_WORK_SECS_ON_BAT="60" |
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
#Peak RT Area% Name Quality Odor Odor-encode | |
12 5.88 0.90 Furfural 90 Medium bready 2 #de795f | |
24 8.80 1.65 Benzaldehyde 97 High fruity 3 #de5f83 | |
25 9.09 0.30 Benzaldehyde 94 High fruity 3 #de5f83 | |
27 9.47 0.45 Methyl_heptenone 97 Medium citric 2 #f0c674 | |
29 9.69 0.83 (E,E)-2,4-heptadienal 94 High fatty 3 #b8baac | |
34 10.50 0.36 Dipentene 92 Medium citric 2 #f0c674 | |
35 10.61 2.57 Benzyl_alcohol 98 Medium floral 2 #b283bd | |
43 12.17 2.64 Linalool 97 Medium floral 2 #b283bd | |
45 12.48 3.06 Phenethyl_alcohol 97 Medium floral 2 #b283bd |
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 python3 | |
import pandas as pd | |
import numpy as np | |
def display(df): | |
options = ['display.max_rows', None] | |
options += ['display.unicode.east_asian_width', True] | |
with pd.option_context(*options): | |
print(df) |
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 bash | |
# https://askubuntu.com/a/562191 | |
usage() { | |
echo Usage: $(basename $0) PATTERN | |
exit 1 | |
} | |
[ $# -ne 1 ] && usage | |
pattern=$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
encode :: Int -> String -> String | |
encode key plain = [shift key p | p <- plain] | |
where shift n c = ['A'..'Z'] !! mod (fromEnum c - fromEnum 'A' + n) 26 | |
decode :: String -> (String, Int) | |
decode cipher = let key = (snd.maximum) search in (encode (-key) cipher, key) | |
where search = zip (drop 25 $ convolve cipher_stats (letter_freqs ++ letter_freqs)) (0:[25,24..1]) | |
cipher_stats = [fromIntegral.length $ filter (==c) cipher | c <- ['A'..'Z']] | |
-- 1D discrete convolution altered from stackoverflow.com/a/39784716 |
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
-- p1 | |
myFst :: (a, b) -> a | |
myFst = fst -- seemed the only way :( | |
-- p2 | |
myOdd :: Int -> Bool | |
myOdd = (==) 1 . flip mod 2 | |
-- p3 | |
{- |
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
-- Build prime number table would be much slower than performing prime tests, | |
-- since we check only x and n-x, and in most cases x < 10 (28.7% when n < 20000). | |
goldbach' :: Int -> Int -> Int -> [Int] | |
goldbach' n m1 m2 = filter (\x -> isPrime x && isPrime (n-x)) $ 3:5:[6+m1,12+m1..n-2] | |
where isPrime x = null $ filter (\y -> x `mod` y == 0) [2..fsqrt x] -- expect x > 1 | |
fsqrt = floor.sqrt.fromIntegral | |
goldbach :: Int -> Maybe (Int, Int) | |
goldbach 4 = Just (2, 2) -- the only case 2 would showed up |
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
stat :: [Int] -> [Int] | |
stat [] = replicate 10 0 | |
stat (x:xs) = (take x stats) ++ [stats !! x + 1] ++ tail (drop x stats) | |
where stats = stat xs | |
plot :: [Int] -> [String] | |
plot ys | |
| all (== 0) ys = [] | |
| otherwise = row : plot ys' | |
where row = map (\y -> if y == 0 then ' ' else '*') ys |
NewerOlder