Skip to content

Instantly share code, notes, and snippets.

View kad1r's full-sized avatar

Kadir Avcı kad1r

View GitHub Profile
@davidfowl
davidfowl / FromSqlInterpolatedStringHandler.cs
Last active July 3, 2023 12:55
Implementation of parameterized sql queries using string interpolation handlers
using System.Data.Common;
using System.Runtime.CompilerServices;
using System.Text;
using Npgsql;
GetCatalogItemsSql(null, null, null, 10);
void GetCatalogItemsSql(int? catalogBrandId, int? before, int? after, int pageSize)
{
// This looks like it would be susceptible to SQL injection, but it's not.
@davidfowl
davidfowl / .NET6Migration.md
Last active October 23, 2024 18:30
.NET 6 ASP.NET Core Migration
@davidfowl
davidfowl / MinimalAPIs.md
Last active October 24, 2024 13:39
Minimal APIs at a glance
@karlhorky
karlhorky / try-catch.ts
Last active October 19, 2022 23:43
Try-catch helper for promises and async/await
export default async function tryCatch<Data>(
promise: Promise<Data>,
): Promise<{ error: Error } | { data: Data }> {
try {
return { data: await promise };
} catch (error) {
return { error };
}
}
@bijai
bijai / scheduledBackup.ps1
Created February 16, 2021 17:10
Postgres periodic local backup
##Parameters
#Number of backups to keep - oldest backup will be deleted
$threshold = 5
#Where to backup [must be exclusive dir]
$dbDumpPath = 'C:\path\for\dump'
#pgdump binary path
$pgdumpPath = 'C:\path\to\pgdump\binary\PostgreSQL\10\bin\pg_dump.exe'
#database params
$dbName = 'db_name'
@selcukcihan
selcukcihan / aws-certification-cheat-sheet.md
Created June 10, 2020 11:34
Cheat sheet for aws certification exams.

S3

  • By default all new buckets are private
  • You can have bucket policies and ACLs (ACL can go down to individual objects)
  • Read after write consistency for puts of new objects
  • Eventual consistency for overwrite PUTs and DELETEs
  • Storage classes
    • S3 standard (99.99 availability, 11 9s durability) can sustain loss of 2 facilities concurrently
    • S3-IA lower fee than S3 but you are charged a retrieval fee (99.9% availability)
    • S3 One Zone - IA lower cost option if you don't need multi AZ data resilience (99.5% availability)
  • S3 Intelligent Tiering
@MuhammetDilmac
MuhammetDilmac / result.json
Created November 14, 2019 09:08
Türkiye Şehirler ve İlçeleri
[
{
"name": "Adana",
"districts": [
{
"name": "Aladağ"
},
{
"name": "Ceyhan"
},
@mikowl
mikowl / oneliners.js
Last active June 29, 2024 17:39
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@bmaupin
bmaupin / free-database-hosting.md
Last active November 16, 2024 22:43
Free database hosting

Hello this archive for How to install react-native on windows?

Step 1: Prerequisites & Prep Work

then you should add Environment variables a new path for SDK and JDK;

JAVA_HOME: C:\path\to\JavaSDK