ifndef MY_FLAG
$(error MY_FLAG is not set)
endif
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
import os | |
import logging | |
import sys | |
import textwrap | |
from llama_index import ( | |
GPTKeywordTableIndex, | |
SimpleDirectoryReader, | |
LLMPredictor, | |
) |
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
CREATE TABLE test | |
( | |
id INTEGER, | |
parent INTEGER | |
); | |
INSERT INTO test (id, parent) VALUES | |
(1, NULL), | |
(2, 1), |
Here is a simple and robust way to check for the validity of an email address syntax directly in the browser. No need for crazy regular expressions.
e = document.createElement('input')
e.type = 'email'
// check some email addresses
e.value = 'hi@'
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
/** | |
* Returns a time-ordered UUID (v6). | |
* | |
* Tags: uuid guid uuid-generator guid-generator generator time order rfc4122 rfc-4122 | |
*/ | |
create or replace function fn_uuid_time_ordered() returns uuid as $$ | |
declare | |
v_time timestamp with time zone:= null; | |
v_secs bigint := null; |
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
-- From https://github.com/geckoboard/pgulid/blob/d6187a00f66dca196cf5242588f87c3a7969df75/pgulid.sql | |
-- | |
-- pgulid is based on OK Log's Go implementation of the ULID spec | |
-- | |
-- https://github.com/oklog/ulid | |
-- https://github.com/ulid/spec | |
-- | |
-- Copyright 2016 The Oklog Authors | |
-- Licensed under the Apache License, Version 2.0 (the "License"); | |
-- you may not use this file except in compliance with the License. |
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
with recursive breadcrumbs(id, parent_id, name) as ( | |
select id, parent_id, name | |
from pages | |
where id = 4 | |
union | |
select p.id, p.parent_id, p.name | |
from pages p | |
inner join breadcrumbs b on p.id = b.parent_id | |
) | |
select * from breadcrumbs; |
SchemaSpy is a neat tool to produce visual diagrams for most relational databases.
Here's how to use it to generate schema relationship diagrams for PostgreSQL databases:
-
Download the jar file from here (the current version is v6.1.0)
-
Get the PostgreSQL JDBC driver (unless your installed version of java is really old, use the latest JDBC4 jar file)
-
Run the command against an existing database. For most databases, the schema (-s option) we are interested in is the public one:
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
import { useCallback, useEffect, useState } from 'react'; | |
import { useSetRecoilState } from 'recoil'; | |
import { useKeycloak } from '@react-keycloak/web'; | |
import { commonNotification } from './common'; | |
/** | |
* Returns the auth info and some auth strategies. | |
* | |
*/ |
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
FROM docker.elastic.co/elasticsearch/elasticsearch:5.5.1 | |
RUN \ | |
mv /usr/share/elasticsearch/plugins/x-pack /usr/share/elasticsearch/plugins/.removing-x-pack && \ | |
mv /usr/share/elasticsearch/plugins/.removing-x-pack /usr/share/elasticsearch/plugins/x-pack && \ | |
/usr/share/elasticsearch/bin/elasticsearch-plugin remove x-pack |
NewerOlder