Skip to content

Instantly share code, notes, and snippets.

@sazid
sazid / PRIVACY-no-ads.md
Created November 17, 2024 06:48
Privacy policy for published apps.

Privacy Policy

Introduction Your privacy is important to us. This Privacy Policy explains how our app handles user data. We are committed to ensuring transparency and clarity regarding the information collected by our app.

Data Collection and Use Our app does not collect, store, or share any personal data or user information. The only data collected is by Google through its Firebase services for analytics purposes. This data helps improve app performance and diagnose any potential issues.

Firebase Services Our app integrates with the following Firebase services:

@sazid
sazid / zeuz_pricing.py
Created August 14, 2023 20:24
zeuz_pricing.py
def inp(msg: str, default_value=None) -> float:
while True:
try:
if default_value is not None:
typ = type(default_value)
user_input = input(f"{msg}: ")
if user_input:
return typ(user_input)
else:
return default_value
@sazid
sazid / main.go
Last active April 13, 2022 09:14
A small generic function for retrying in go.
func main() {
db, err := util.Retry(120, time.Second, func() (*pgxpool.Pool, error) {
return pgxpool.Connect(...)
})
if err != nil {
log.Fatal("failed to initialize new postgres db pool")
}
}
@sazid
sazid / DBUtils.kt
Created August 30, 2021 06:59
Database utilities for JDBC
package io.github.sazid
import java.sql.Connection
import java.sql.Date
import java.sql.PreparedStatement
import java.sql.ResultSet
import java.time.LocalDate
import javax.sql.DataSource
typealias RowMapper<T> = (ResultSet) -> T
@sazid
sazid / IOStream.java
Last active July 21, 2021 17:54
Trying out different I/O streams in Java.
import java.io.*;
import static java.lang.System.out;
public class Main {
public static void main(String[] args) {
try (var in = new FileInputStream("hello.txt")) {
var buf = new byte[4];
int n = in.read(buf);
while (n != -1) {
@sazid
sazid / go_seek_handle.go
Created June 10, 2021 12:35
Demonstration of file seek handle in Go.
package main
import (
"fmt"
"io"
"io/ioutil"
"os"
"strings"
)
@sazid
sazid / redhat_nginx_setup.md
Created November 30, 2020 21:25
Redhat Enterprise Linux 8 nginx setup
  1. Create /etc/nginx/sites-available /etc/nginx/sites-enabled directories
  2. Add "include /etc/nginx/sites-enabled/*;" in http block
user ec2-user;  # SET THE PROPER USER HERE!
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
// Holds the graph
map<char, vector<char>> graph;
// Status of each node - UNVISITED, VISITING, VISITED
map<char, int> status;
// This will denote whether the graph has cycles
bool hasCycles = false;
// Status codes
int main() {
// Input graph here
for (char c : {'A', 'B', 'C'})
if (status[c] == UNVISITED)
dfs(c);
if (hasCycles) {
// Do something
}
void dfs(char node) {
status[node] = VISITING;
for (char child : graph[node]) {
if (status[child] == UNVISITED)
dfs(child);
else if (status[child] == VISITING) {
hasCycles = true;
return;
}