Skip to content

Instantly share code, notes, and snippets.

View coco98's full-sized avatar

Tanmai Gopal coco98

View GitHub Profile
@coco98
coco98 / 1000-factorial.txt
Created April 10, 2024 22:09
1000!- 1000 factorial
4023872600770937735437024339230039857193748642107146325437999104299385123986290205920442084869694048004799886101971960586316668729948085589013238296699445909974245040870737599188236277271887325197795059509952761208749754624970436014182780946464962910563938874378864873371191810458257836478499770124766328898359557354325131853239584630755574091142624174743493475534286465766116677973966688202912073791438537195882498081268678383745597317461360853795345242215865932019280908782973084313928444032812315586110369768013573042161687476096758713483120254785893207671691324484262361314125087802080002616831510273418279777047846358681701643650241536913982812648102130927612448963599287051149649754199093422215668325720808213331861168115536158365469840467089756029009505376164758477284218896796462449451607653534081989013854424879849599533191017233555566021394503997362807501378376153071277619268490343526252000158885351473316117021039681759215109077880193931781141945452572238655414610628921879602238389714760885062768629671466746975
@coco98
coco98 / messages.sql
Created September 27, 2022 22:59
Sample messages table and data for testing out a streaming GraphQL API
-- After adding a Postgres source to your Hasura project,
-- head to the "Run SQL" page and copy-pasta the following SQL.
-- This SQL creates a messages table and inserts a 100 messages into the table.
CREATE TABLE messages (
id bigserial primary key,
message text
);
INSERT INTO messages (message) VALUES
@coco98
coco98 / cron-trigger-clean-up
Created January 27, 2022 17:00
Clean up Events with a cron trigger
{
"resource_version": 8,
"metadata": {
"version": 3,
"sources": [
{
"name": "default",
"kind": "postgres",
"tables": [
{
@coco98
coco98 / reduced-chinook.sql
Created April 20, 2021 18:03
Reduced chinook Postgres dataset
-- -- /*******************************************************************************
-- -- Chinook Database - Version 1.4
-- -- Script: Chinook_PostgreSql.sql
-- -- Description: Creates and populates the Chinook database.
-- -- DB Server: PostgreSql
-- -- Author: Luis Rocha
-- -- License: http://www.codeplex.com/ChinookDatabase/license
-- -- Modified By: John Atten
@coco98
coco98 / track_all_tables.py
Last active September 16, 2021 19:24
Track tables in python (Hasura)
import requests
#Fetch existing tables
tables = requests.post('http://localhost:8080/v1/query', json={
"type":"select",
"args":{
"table": {"schema": "information_schema", "name": "tables"},
"columns": ["table_name"],
"where": {"table_schema": {"$eq": "public"}}
}
@coco98
coco98 / update-relationships.graphql
Last active March 13, 2019 06:34
single mutation to update relationships
#Without query variables
mutation updateChildren {
delete_children(where: {parent_id: {_eq: 1}}) {
affected_rows
}
insert_children(objects: [{name: "child1", parent_id: 1}, {name: "child2", parent_id: 1}]) {
affected_rows
}
@coco98
coco98 / chinook_hasura_postgres_db.sql
Created January 15, 2019 14:03
Chinook dataset to be imported into postgres - ideal for hasura demo
This file has been truncated, but you can view the full file.
-- -- /*******************************************************************************
-- -- Chinook Database - Version 1.4
-- -- Script: Chinook_PostgreSql.sql
-- -- Description: Creates and populates the Chinook database.
-- -- DB Server: PostgreSql
-- -- Author: Luis Rocha
-- -- License: http://www.codeplex.com/ChinookDatabase/license
-- -- Modified By: John Atten
{
"user": [
{
"id": 456,
"name": "Sita K",
"address": {
"country": "India"
}
},
{
mutation($message: messages_insert_input!) {
insert_messages(objects:[$message]) {
returning {
id
sender_id
message
}
}
}
mutation($message: messages_insert_input!) {
insert_messages(objects:[$message]) {
returning {
id
sender_id
message
}
}
}