This file contains hidden or 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
let | |
pkgs = | |
let | |
pinnedPkgs = | |
builtins.fetchGit { | |
name = "nixos-unstable-2019-12-05"; | |
url = https://github.com/nixos/nixpkgs/; | |
rev = "cc6cf0a96a627e678ffc996a8f9d1416200d6c81"; | |
}; | |
in |
This file contains hidden or 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
# Automatic nginx virtual subdomains with sub-folders or sub-directories | |
# | |
# Since the original source where I found this code is now offline, I have decided to mirror it here. | |
# All credit goes to: http://web.archive.org/web/20150307193208/http://www.messaliberty.com/2010/10/automatic-nginx-virtual-subdomains-with-sub-folders-or-sub-directories | |
# | |
# Description: In my web root directory I wanted create a folder called photos, and another called | |
# music using a sftp program. Without manually going back to the config file or to the shell I like to | |
# be able to access them at photos.nginxdomain.com and music.nginxdomain.com. That is what this config does. | |
# Redirect visitors from http://nginxdomain.com/ to http://www.nginxdomain.com/ |
This file contains hidden or 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
# Automatic nginx virtual subdomains with sub-folders or sub-directories | |
# | |
# Since the original source where I found this code is now offline, I have decided to mirror it here. | |
# All credit goes to: http://web.archive.org/web/20150307193208/http://www.messaliberty.com/2010/10/automatic-nginx-virtual-subdomains-with-sub-folders-or-sub-directories | |
# | |
# Description: In my web root directory I wanted create a folder called photos, and another called | |
# music using a sftp program. Without manually going back to the config file or to the shell I like to | |
# be able to access them at photos.nginxdomain.com and music.nginxdomain.com. That is what this config does. | |
# Redirect visitors from http://nginxdomain.com/ to http://www.nginxdomain.com/ |
This file contains hidden or 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
CREATE EXTENSION pgcrypto; | |
CREATE OR REPLACE FUNCTION totp(key BYTEA, clock_offset INT DEFAULT 0) RETURNS INT AS $$ | |
DECLARE | |
c BYTEA := '\x000000000' || TO_HEX(FLOOR(EXTRACT(EPOCH FROM NOW()) / 30)::INT + clock_offset); | |
mac BYTEA := HMAC(c, key, 'sha1'); | |
trunc_offset INT := GET_BYTE(mac, 19) % 16; | |
result INT := SUBSTRING(SET_BIT(SUBSTRING(mac FROM 1 + trunc_offset FOR 4), 7, 0)::TEXT, 2)::BIT(32)::INT % 1000000; | |
BEGIN | |
RETURN result; | |
END; |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<rss version="2.0"> | |
<channel> | |
<title>Example Feed</title> | |
<description>Insert witty or insightful remark here</description> | |
<link>http://example.org/</link> | |
<lastBuildDate>Sat, 13 Dec 2003 18:30:02 GMT</lastBuildDate> | |
<managingEditor>[email protected] (John Doe)</managingEditor> |
This file contains hidden or 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 imap_user="[email protected]" | |
set imap_pass=`/usr/bin/security find-generic-password -w -a '[email protected]' -s 'Gmail'` | |
set folder=imaps://imap.gmail.com/ | |
set spoolfile=+INBOX | |
set record="+[Gmail]/Sent Mail" | |
set postponed="+[Gmail]/Drafts" | |
# https://www.neomutt.org/guide/reference search sleep_time for additional info | |
set sleep_time=0 # be faster |
This file contains hidden or 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
-- Functions to create and draw histograms with PostgreSQL. | |
-- | |
-- psql# WITH email_lengths AS ( | |
-- -# SELECT length(email) AS length | |
-- -# FROM auth_user | |
-- -# LIMIT 100 | |
-- -# ) | |
-- -# SELECT * FROM show_histogram((SELECT histogram(length, 0, 32, 6) FROM email_lengths)) | |
-- bucket | range | count | bar | cumbar | cumsum | cumpct | |
-- --------+-------------------------------------+-------+--------------------------------+--------------------------------+--------+------------------------ |
This file contains hidden or 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
begin; | |
-- Load in uuid-ossp extension for uuid_generate_v1mc | |
create schema "uuid-ossp"; | |
create extension "uuid-ossp" with schema "uuid-ossp"; | |
-- Create roles | |
create role alice; | |
create role bob; |
This file contains hidden or 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
-- from https://gist.github.com/ruslantalpa/b2f10eb1b5f6dd0fc1c154e071a1c91b | |
\set API_SCHEMA_NAME test | |
with tables as ( | |
-- Return a list of entities in the database (tables/views/materialized views) | |
select | |
n.nspname as table_schema, | |
relname as table_name, | |
case |
This file contains hidden or 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
-- http GET "localhost:3000/items?select=id,name,c1,c2,c3,c4,subitems{id,name}&id=lte.100" | |
\set rid random(1, 999900) | |
BEGIN ISOLATION LEVEL READ COMMITTED READ ONLY; | |
WITH pg_source AS ( | |
SELECT | |
"new_m2m_child_queries"."items"."id", | |
"new_m2m_child_queries"."items"."name", |