Skip to content

Instantly share code, notes, and snippets.

View raikusy's full-sized avatar
:electron:
Reacting 🌸

Rakibul Hasan raikusy

:electron:
Reacting 🌸
View GitHub Profile
@raikusy
raikusy / helpers.ts
Created December 7, 2023 07:27 — forked from rphlmr/helpers.ts
Drizzle ORM, deep sub queries
export function distinctOn<Column extends AnyColumn>(column: Column) {
return sql<Column["_"]["data"]>`distinct on (${column}) ${column}`;
}
export function jsonBuildObject<T extends SelectedFields>(shape: T) {
const chunks: SQL[] = [];
Object.entries(shape).forEach(([key, value]) => {
if (chunks.length > 0) {
chunks.push(sql.raw(`,`));
function fixSerialNumbers(data) {
// Functions for number conversions
const toEn = (n) => n.replace(/[০-৯]/g, (d) => "০১২৩৪৫৬৭৮৯".indexOf(d));
const toBn = (n) => n.replace(/\d/g, (d) => "০১২৩৪৫৬৭৮৯"[d]);
// A helper function to pad the serial number with leading zeros
const padSerial = (num) => num.toString().padStart(4, "0");
// Set to keep track of used serial numbers
let usedSerials = new Set();
@raikusy
raikusy / devops_best_practices.md
Created April 22, 2021 22:59 — forked from jpswade/devops_best_practices.md
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, Andrew Shafer did a talk called "Agile Infrastucture" addressing issues around involving more of the company in the same disciplines as programmers.

In 2009, Patrick Debois created "DevOpsDays" conference to help to bring it to light. However, it wouldn't begin to trend until about 2010, when people would begin to describe it as a standalone discipline.

Today, DevOps goes beyond just developers, systems administration and infrastructure, its about [dev, ops, agile, cloud

@raikusy
raikusy / setup-aws.sh
Last active February 1, 2021 06:23
A bash script to setup docker, docker-compose, volta, node, yarn into any ubuntu machine. (using for aws lightsail)
#!/bin/sh
command_exists() {
command -v "$@" > /dev/null 2>&1
}
user="$(id -un 2>/dev/null || true)"
sh_c='sh -c'
if [ "$user" != 'root' ]; then
if command_exists sudo; then
@raikusy
raikusy / main.c
Created March 30, 2020 08:45
Calender C Program
#include <stdio.h>
int get_starter(int year) {
int day = (((year - 1) * 365) + ((year - 1) / 4) - ((year - 1) / 100) + ((year) / 400) + 1) % 7;
return day;
}
int main() {
int year, month, date, dayinM, dayinW = 0, starter;
printf("\n ENTER THE YEAR:");
const axios = require('axios');
const url = 'http://todorestapi.test'
function ContactsList(props) {
const [contactList, setcontactList] = useState([]);
const init = async () => {
const response = await fetch(url + '/api/contact/all');
const json = await response.json()
console.log(json);
@raikusy
raikusy / specs.md
Created October 16, 2019 15:29
PC Configuration

Mobo: ASUS TUF Z370-PLUS GAMING

CPU: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz

GPU: GeForce GTX 1050 Ti/PCIe/SSE2

Ram: Corsair 8gb DDR4 (Will add 8gb more)

SSD: WDC 240GB

onFormSubmit = e => {
e.preventDefault();
this.fileUpload(this.state.image);
};
onChange = e => {
const files = e.target.files || e.dataTransfer.files;
if (!files.length) return;
this.createImage(files[files.length - 1]);
};
class Book {
constructor(author, isbn, genre) {
this.author = author;
this.isbn = isbn;
this.genre = genre;
}
getDescription() {
return this.author+' '+this.isbn+' '+this.genre;
}
}
//defining pins and variables
#define lefts A4
#define rights A5
// connect motor controller pins to Arduino digital pins
// motor one
int enA = 10;
int in1 = 9;
int in2 = 8;
// motor two