Skip to content

Instantly share code, notes, and snippets.

View avinayak's full-sized avatar

Atul Vinayak avinayak

  • Hiive
  • Vancouver, BC
  • 07:59 (UTC -07:00)
View GitHub Profile
@avinayak
avinayak / gist:b79991439ddc5d86b8f669e0e1e8082e
Created February 5, 2021 07:15
CMakeList.txt for SDL2 Projects in CLion
cmake_minimum_required(VERSION 3.17)
project(Pong)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
add_executable(Pong main.cpp pong.cpp pong.h)

1. pg. xxi: Care About Your Craft

Why spend your life developing software unless you care about doing it well?

2. pg. xxi: Think! About Your Work

Turn off the autopilot and take control. Constantly critique and appraise your work.

3. pg. 2: You Have Agency

@avinayak
avinayak / hello.exs
Last active May 15, 2022 09:30
Simplest plug based http sever
# run with $ elixir --no-halt hello.exs
Mix.install([{:plug_cowboy, "~> 2.0"}])
defmodule HWPlug.Plug do
import Plug.Conn
def init(options), do: options
def call(conn, _opts) do
conn
@avinayak
avinayak / cron.exs
Created May 16, 2022 06:51
A interval cron thing in genserver
defmodule Cron do
use GenServer
@name __MODULE__
def start_link(initial_map) do
GenServer.start_link(__MODULE__, initial_map, name: @name)
end
def add_job(key, job, interval) do
GenServer.cast(@name, {:add_job, {key, job, interval}})
@avinayak
avinayak / japanese_vocab_study_order.json
Created September 4, 2022 19:40
japanese_vocab_study_order.json
This file has been truncated, but you can view the full file.
{
"あっち": {
"index": 3,
"word": "あっち",
"kana": "",
"romaji": "",
"type": "Pronoun",
"jlpt": 5,
"meaning": "over there",
"card": "word",
@avinayak
avinayak / jvoc.json
Created September 4, 2022 20:48
jvoc.json
[
{
"w": "あっち",
"k": "",
"k_en": "",
"m": "over there",
"wt": "Pronoun",
"j": 5,
"i": 1,
"c": "w"
@avinayak
avinayak / audit_log.sql
Created June 6, 2023 23:05
Automated jsonb audit_log generator for all tables in current schema
CREATE TABLE audit_log (
id serial PRIMARY KEY,
object_id uuid NOT NULL,
object_type VARCHAR(50),
event VARCHAR(50),
delta JSONB,
timestamp TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);