Skip to content

Instantly share code, notes, and snippets.

View krummja's full-sized avatar

Jonathan Crum krummja

View GitHub Profile
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 16, 2024 10:46
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@anddam
anddam / results
Last active December 9, 2022 14:45 — forked from anonymous/untitled.py
SQLAlchemy aggregate functions example
In [29]: my_sub = db.session.query(TestModel.name, func.count(TestModel.id).label('count')).group_by(TestModel.name).subquery()
In [30]: db.session.query(TestModel, my_sub.c.count).outerjoin(my_sub, TestModel.name==my_sub.c.name).all()
Out[30]: [(<1: Bob>, 1), (<2: Alice>, 2), (<3: Alice>, 2)]
@masayu-a
masayu-a / gist:e3eee0637c07d4019ec9
Last active June 26, 2024 19:47
English Tagset for UniDic - English translations of UniDic POS tags, prepared by Irena Srdanovic, 17.1.2013, checked by Ogiso, Den and Maekawa
PoS(Ja) PoS (En) PoS (En) - descriptions
代名詞 Pron pronoun
副詞 Adv adverb
助動詞 Aux auxiliary_verb
助詞-係助詞 P.bind particle(binding)
助詞-副助詞 P.adv particle(adverbial)
助詞-接続助詞 P.conj particle(conjunctive)
助詞-格助詞 P.case particle(case)
助詞-準体助詞 P.nom particle(nominal)
@zsoi
zsoi / TerrainDataCloner.cs
Last active January 4, 2024 17:57
Helper to deep-copy a TerrainData object in Unity3D
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ZS.Tools
{
/// <summary>
/// Provides means to deep-copy a TerrainData object because Unitys' built-in "Instantiate" method
@njbbaer
njbbaer / ca.py
Last active October 27, 2022 18:05
Fast implementation of cellular automata using 2D convolution
import time
import numpy as np
from numpy.fft import fft2, ifft2
from matplotlib import pyplot, animation
def fft_convolve2d(board, kernal):
board_ft = fft2(board)
kernal_ft = fft2(kernal)
height, width = board_ft.shape
@attolee
attolee / unity-gameobject-traveller.cs
Last active October 8, 2021 13:31
traverse unity gameobject's hierarchy by recursion
/*
* https://en.wikipedia.org/wiki/Tree_(data_structure)
*/
private static List<GameObject> Traverse(GameObject parent, Type type)
{
List<GameObject> children = new List<GameObject>();
foreach (Transform node in parent.transform)
children.Add(node.gameObject);
@phi-lira
phi-lira / UniversalPipelineTemplateShader.shader
Last active July 8, 2024 08:35
Template shader to use as guide to create Universal Pipeline ready shaders. This shader works with Universal Render Pipeline 7.1.x and above.
// When creating shaders for Universal Render Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this teamplate as a base.
// Please note, this shader does not necessarily match perfomance of the built-in URP Lit shader.
// This shader works with URP 7.1.x and above
Shader "Universal Render Pipeline/Custom/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
@FractalWire
FractalWire / wall.py
Last active February 10, 2021 00:44
get the value of a wall
from math import cos, sin, pi
from enum import IntFlag
import numpy as np
# OUTPUT :
#
# Walkable space :
# [[ True True True True True]
# [ True False False False True]
# [ True False False False True]
@Yanrishatum
Yanrishatum / hxsl-cheatsheet.md
Last active June 26, 2024 08:04
HXSL cheat-sheet

HXSL cheat-sheet

This is a WIP of a cheat-sheet that I will finish Eventually™

Types

Mapping of the shader types to Heaps types:

Float = Float
Int = Int
Bool = Bool
@splch
splch / readability.css
Last active November 29, 2022 23:04
CSS rules optimized for site readability
:root {
--bg-color: #ffffff;
--font-color: #000000;
/* highest contrast colors
for light and dark themes */
--red: #ec0000;
--green: #008900;
--blue: #5f5fff;
--gray: #757575;
}