I hereby claim:
- I am requaos on github.
- I am requaos (https://keybase.io/requaos) on keybase.
- I have a public key ASCpdfI1zctm92moE2Culbg68Teg7bMacSDu7Tip8wjjtAo
To claim this, I am signing this object:
#! /usr/bin/env nix-shell | |
#! nix-shell -i bash -p bash xorg.xrandr brightnessctl | |
CONNECTED_DISPLAYS="$(xrandr | grep "\sconnected" | awk '{ print $1 }')" | |
DOCK_LEFT="DVI-I-2-2" | |
DLF="0" | |
DOCK_CENTER="HDMI-0" | |
DCF="0" | |
DOCK_RIGHT="DVI-I-1-1" | |
DRF="0" |
{ | |
config, | |
pkgs, | |
lib, | |
inputs, | |
... | |
}: let | |
ipu6-camera-bin = with pkgs; | |
stdenv.mkDerivation rec { | |
pname = "ipu6-camera-bin"; |
# Neil Skinner | |
# I like brains | |
initials = { | |
'N': [17, 25, 21, 19, 17, 17, 17], | |
'S': [14, 17, 16, 14, 1, 17, 14], | |
} | |
def zipped_map(things): | |
l = [] |
I hereby claim:
To claim this, I am signing this object:
START TRANSACTION; | |
create function tallreach_rank(time_threshold integer, time_posted timestamp with time zone, up_votes integer, down_votes integer) returns numeric | |
immutable | |
language plpgsql | |
as | |
$$ | |
DECLARE | |
start_time TIMESTAMP WITH TIME ZONE; | |
Ts INT; |
-- From: https://stackoverflow.com/questions/8871426/how-to-calculate-an-exponential-moving-average-on-postgres | |
start transaction; | |
create or replace function ema_func(state numeric, inval numeric, alpha numeric) | |
returns numeric | |
language plpgsql as $$ | |
begin | |
return case | |
when state is null then inval | |
else alpha * inval + (1-alpha) * state |
-- Forwarning: This function is not optimized, so please leave a coment if you see something that I didn't | |
start transaction; | |
create or replace function rsi_func(state circle, inval numeric) | |
returns circle | |
language plpgsql as $$ | |
begin | |
return case | |
when state is null then (select circle(point(sum(CASE WHEN t.gains >= 0 THEN t.gains ELSE 0 END)/14,(abs(sum(CASE WHEN t.gains < 0 THEN t.gains ELSE 0 END))/14)), inval) rs from (select price - lag(price, 1) over (rows between 14 preceding and current row) gains from quotes where type = 'last') as t) | |
else circle(point(((select g[0] from point(state) as g) * 13 + (CASE WHEN inval - radius(state) >= 0 THEN inval - radius(state) ELSE 0 END))/14,((select l[1] from point(state) as l) * 13 + (CASE WHEN inval - radius(state) < 0 THEN inval - radius(state) ELSE 0 END))/14), inval) |
logger := zap.NewNOP() | |
err = pilot.Insert(ctx, m.DB.Master(), boil.Infer()) | |
switch err := errors.Cause(err).(type) { | |
case nil: | |
// Carry on | |
case *pq.Error: | |
if err.Code.Name() == "unique_violation" && err.Constraint == "unique_constraint_name" { | |
// Do something | |
return nil |
START TRANSACTION; | |
ALTER TABLE public.stories | |
ADD COLUMN text_search tsvector; | |
UPDATE public.stories SET text_search = | |
setweight(to_tsvector(author), 'A') || | |
setweight(to_tsvector(title), 'A') || | |
setweight(to_tsvector(description), 'B'); |
DO $$ | |
declare | |
urlprefix text; | |
thing RECORD; | |
BEGIN | |
FOR thing in (SELECT * from stories where image like '/%') LOOP | |
urlprefix = substring(thing.url, '^.+?\/\/.+?\/'); | |
UPDATE stories SET image = LEFT(urlprefix, LENGTH(urlprefix)-1) || thing.image WHERE id = thing.id; | |
END LOOP; |