Skip to content

Instantly share code, notes, and snippets.

View girisagar46's full-sized avatar
🇯🇵
Focusing

Sagar Giri girisagar46

🇯🇵
Focusing
View GitHub Profile
@girisagar46
girisagar46 / update.py
Created June 2, 2023 05:37 — forked from bmispelon/update.py
[Django ORM] Updating a JSONField based on the value of another field
"""
How to update JSONField based on the value of another field.
For example:
class MyModel(models.Model):
name = models.CharField(...)
data = models.JSONField()
How to update the MyModel table to store the `name` field inside the `data`

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@girisagar46
girisagar46 / postgres-cheatsheet.md
Created August 26, 2022 02:11 — forked from Kartones/postgres-cheatsheet.md
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)
@girisagar46
girisagar46 / comments.md
Created May 6, 2022 13:48 — forked from adamveld12/comments.md
Go Code Review Comments

Go Code Review Comments

This page collects common comments made during reviews of Go code, so that a single detailed explanation can be referred to by shorthands. This is a laundry list of common mistakes, not a style guide.

You can view this as a supplement to http://golang.org/doc/effective_go.html.

Please discuss changes before editing this page, even minor ones. Many people have opinions and this is not the place for edit wars.

@girisagar46
girisagar46 / installing_cassandra.md
Created February 17, 2022 15:08 — forked from hkhamm/installing_cassandra.md
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@girisagar46
girisagar46 / build.gradle
Created August 18, 2021 08:38
build.gradle sample
plugins {
id 'java'
}
group 'com.github.girisagar46'
version '1.0'
repositories {
mavenCentral()
}
import groovy.transform.*
println("Hello World")
println "Hello World"
println 'Hello World'
String name = 'Sagar'
println "Hello $name"
println "Hello ${name}"

Keybase proof

I hereby claim:

  • I am girisagar46 on github.
  • I am girisagar46 (https://keybase.io/girisagar46) on keybase.
  • I have a public key whose fingerprint is 0EF4 4103 3F11 7014 6790 70E0 AEAE F902 8090 DF96

To claim this, I am signing this object:

...
# HELP jvm_gc_live_data_size_bytes Size of long-lived heap memory pool after reclamation
# TYPE jvm_gc_live_data_size_bytes gauge
jvm_gc_live_data_size_bytes 0.0
# HELP jvm_buffer_count_buffers An estimate of the number of buffers in the pool
# TYPE jvm_buffer_count_buffers gauge
jvm_buffer_count_buffers{id="mapped - 'non-volatile memory'",} 0.0
jvm_buffer_count_buffers{id="mapped",} 0.0
jvm_buffer_count_buffers{id="direct",} 2.0
# HELP jvm_memory_used_bytes The amount of used memory
import java.io.IOException;
public class Main {
public static void main(String[] args) {
Actuator actuator = new Actuator(MetricService.getRegistry());
try {
actuator.start();
} catch (IOException ioException) {
actuator.stop();