Skip to content

Instantly share code, notes, and snippets.

@lauzi
lauzi / gist:9346664
Created March 4, 2014 13:40
エロゲー初心者にお勧めな作品
SELECT G.gamename, S.points
FROM (SELECT game, SUM(CASE WHEN rank = 'A' THEN 3
WHEN rank = 'B' THEN 2
WHEN rank = 'C' THEN 1
ELSE 0 END) AS points
FROM povgroups
WHERE pov = 28
GROUP BY game
ORDER BY points DESC LIMIT 21) S
INNER JOIN gamelist G
@lauzi
lauzi / 2b.hs
Last active August 29, 2015 13:57
import Data.List
import Data.Maybe (maybeToList)
import Data.Functor ((<$>))
import Data.Function (on)
import Control.Monad (when)
import qualified Data.Array.Unboxed as U
import qualified Data.Array.ST as ST
import qualified Data.ByteString.Char8 as B hiding (minimum)
getPows :: Int -> Int -> Int
#include <cstdio>
#include <vector>
using namespace std;
typedef long long LL;
const int MAXV = 100001;
const LL MOD = 1000000007;
struct GG {
int qq[2];
GG (int n=0, int b=0) { qq[0] = n, qq[1] = b; }
};
std::vector<GG> vec;
unsigned pushback(int nxt, int b) {
vec.push_back(GG(nxt, b));
return vec.size()-1;
@lauzi
lauzi / pc.cpp
Created November 24, 2014 15:51
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 19;
bool line_used[8][MAXN*3+3];
int idxs[MAXN][MAXN][8];
void init() {
-- 1
main = interact $ show . sum . map read . tail . lines
-- 2
f [a, b, c] = if a <= b then 0 else (a-b)*c
main = interact $ show . sum . map (f . map read . words) . tail . lines
-- 3
import Control.DeepSeq
@lauzi
lauzi / re.hs
Created December 4, 2014 17:33
f :: (Int, [Int]) -> Int
f (t, xs) = maximum $ zipWith (-) (drop t ys) ys
where ys = scanl (+) 0 xs
main = interact $ show . f . p . lines
where p (hd:tl) = (read . head $ words hd, map read tl)
#/bin/usr/zsh
alias clearfucks="FUCKSGIVEN=0"
fucksgiven () {
if [ $FUCKSGIVEN = ]; then
export FUCKSGIVEN=0
fi
echo $FUCKSGIVEN fucks given
}
@lauzi
lauzi / build_fail.log
Created June 30, 2019 05:04
stack setup fail
❯ # MacOS Mojave 10.14.4
❯ rm -rf ~/.stack
❯ PATH=$HOME/.local/bin:/usr/bin:/bin:/usr/sbin stack setup -v
Version 2.1.1, Git revision f612ea85316bbc327a64e4ad8d9f0b150dc12d4b (7648 commits) x86_64 hpack-0.31.2
2019-06-30 12:52:45.476934: [debug] Checking for project config at: /Users/lauzi/Projects/check-amazon/stack.yaml
2019-06-30 12:52:45.477196: [debug] Loading project config file stack.yaml
2019-06-30 12:52:45.499053: [debug] Migration executed: CREATE TABLE "config_cache"("id" INTEGER PRIMARY KEY,"directory" VARCHAR NOT NULL DEFAULT (hex(randomblob(16))),"type" VARCHAR NOT NULL,"pkg_src" VARCHAR NOT NULL,"active" BOOLEAN NOT NULL,"path_env_var" VARCHAR NOT NULL,"haddock" BOOLEAN NOT NULL DEFAULT 0,CONSTRAINT "unique_config_cache" UNIQUE ("directory","type"))
2019-06-30 12:52:45.499201: [debug] Migration executed: CREATE TABLE "config_cache_dir_option"("id" INTEGER PRIMARY KEY,"config_cache_id" INTEGER NOT NULL REFERENCES "config_cache","index" INTEGER NOT NULL,"option" VARCHAR NOT NULL,CONSTRAINT "uniqu