Skip to content

Instantly share code, notes, and snippets.

View thedanielhanke's full-sized avatar

Daniel Hanke thedanielhanke

  • RE: GmbH
  • Cologne, Germany
View GitHub Profile
@thedanielhanke
thedanielhanke / tutorial.md
Created August 9, 2018 10:47 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

{
//given:
const repo - bare Repository {}
const branchCommit = repo.getBranchCommit(branchName),
// actual method:
open: async (fn) => {
const tree = await branchCommit.getTree();
const treeBuilder = await nodegit.Treebuilder.create(repo, tree);
@thedanielhanke
thedanielhanke / auto_treebuilder_test.py
Created November 20, 2018 22:58 — forked from uniphil/auto_treebuilder_test.py
pygit2 auto treebuilder
"""
Defines a function `auto_insert` to help with
`pygit2.Repository.TreeBuilder`s.
Just create the top-level `TreeBuilder`, and it will handle all subtree
creation if you give it paths.
"""
import shutil
from tempfile import mkdtemp
@thedanielhanke
thedanielhanke / integer.rb
Created January 26, 2021 15:09 — forked from pithyless/integer.rb
Ruby Integer::MAX and Integer::MIN
class Integer
N_BYTES = [42].pack('i').size
N_BITS = N_BYTES * 16
MAX = 2 ** (N_BITS - 2) - 1
MIN = -MAX - 1
end
p Integer::MAX #=> 4611686018427387903
p Integer::MAX.class #=> Fixnum
p (Integer::MAX + 1).class #=> Bignum
@thedanielhanke
thedanielhanke / postgres_queries_and_commands.sql
Created June 23, 2021 21:11 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@thedanielhanke
thedanielhanke / docker-api-port.md
Created March 15, 2024 08:26 — forked from styblope/docker-api-port.md
Enable TCP port 2375 for external connection to Docker

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}