Skip to content

Instantly share code, notes, and snippets.

View rraval's full-sized avatar

Ronuk Raval rraval

View GitHub Profile
width = 40
height = 30
alive = '#'
dead = '-'
for i in range(height):
for j in range(width):
print "#ifndef CELL_%02d_%02d" % (i, j)
print "#define CELL_%02d_%02d 0" % (i, j)
print "#endif"
@rraval
rraval / conway.h
Created January 13, 2011 22:07
Generated header file for Conway's Game of Life simulator
#ifndef CELL_00_00
#define CELL_00_00 0
#endif
#undef GRID_00_00
#ifndef CELL_00_01
#define CELL_00_01 0
#endif
#undef GRID_00_01
#ifndef CELL_00_02
#define CELL_00_02 0

Keybase proof

I hereby claim:

  • I am rraval on github.
  • I am rraval (https://keybase.io/rraval) on keybase.
  • I have a public key whose fingerprint is D7C7 F570 8E5A AFAC E0ED 8D4C 5D18 C315 6914 2F5F

To claim this, I am signing this object:

@rraval
rraval / Player.log
Created March 15, 2015 18:34
Cities: Skylines no overlays
Loading Mono
Mono location: /home/rraval/.local/share/Steam/SteamApps/common/Cities_Skylines/Cities_Data/Mono/x86_64
Native OpenGL graphics device hijacked
Loading Steamworks
Setting breakpad minidump AppID = 255710
Steam_SetMinidumpSteamID: Caching Steam ID: 76561198034900764 [API loaded no]
Steam ID: 255710 [Message]
OnUserStatsReceived() Received stats and achievements
OnUserStatsReceived() Received stats and achievements
OnUserStatsReceived() Received stats and achievements
@rraval
rraval / identity.hs
Last active December 9, 2015 15:41
A non-trivial identity function that is not bottom
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
import Prelude hiding (id)
import Data.Char (chr, ord)
-- A simple typeclass with a single instance for `Char` that lets us return a
@rraval
rraval / postgres-collation.md
Last active December 6, 2023 16:25
PostgreSQL collation is a massive footgun

This is a slightly stripped down version from our internal bug tracker. The point of posting this publicly is part FYI, part peer review. I'm hoping someone can look at this, disagree, and tell me all the downsides of using the C locale or point out things I've misunderstood. The Recommendations section in particular is contextualized by our database serving a SaaS product for users from many different locales, thus making locale a render level concern. YMMV, caveat emptor, etc.


Collation defines the character ordering for textual data. For Postgres, https://www.postgresql.org/docs/current/static/locale.html:

The locale settings influence the following SQL features:

  • Sort order in queries using ORDER BY or the standard comparison operators on textual data
  • The upper, lower, and initcap functions
@rraval
rraval / android-studio-kotlin-3.4.0.18-1.patch
Created April 18, 2019 14:56
Patch to get the AUR package for Android Studio to detect the Kotlin plugin as compatible
--- build.txt 1969-12-31 19:00:00.000000000 -0500
+++ build.txt 2019-04-09 20:46:11.000000000 -0400
@@ -0,0 +1 @@
+AI-183.5429.30.34.5452501
\ No newline at end of file
--- product-info.json 1969-12-31 19:00:00.000000000 -0500
+++ product-info.json 2019-04-09 20:46:16.000000000 -0400
@@ -0,0 +1,14 @@
+{
+ "name": "Android Studio",
@rraval
rraval / change.diff
Created April 25, 2021 16:50
Manually rewriting pulumi state to work around https://github.com/pulumi/pulumi/issues/3979
--- export.json 2021-04-25 12:41:04.521802171 -0400
+++ import.json 2021-04-25 12:44:46.172536156 -0400
@@ -580,7 +580,7 @@
"provider": "urn:pulumi:gcloud::zeroindexed::pulumi:providers:gcp::default_5_0_0::e7711df7-8689-4b4b-8243-8de083d8a263"
},
{
- "urn": "urn:pulumi:gcloud::zeroindexed::pulumi:providers:kubernetes::zeroindexed",
+ "urn": "urn:pulumi:gcloud::zeroindexed::pulumi:providers:kubernetes::kubernetes-provider",
"custom": true,
"id": "a22b0294-4801-42fa-8df4-f7bdbf31d34a",