Skip to content

Instantly share code, notes, and snippets.

View WahidinAji's full-sized avatar
🐲
The Power Of Anu🔥🔥🔥

Cakrawala WahidinAji

🐲
The Power Of Anu🔥🔥🔥
View GitHub Profile
@WahidinAji
WahidinAji / go.go
Last active January 19, 2024 08:51
badWors
package main
import (
"fmt"
"strings"
)
type BadWord struct {
Word string
}
@WahidinAji
WahidinAji / Database.php
Last active March 30, 2024 04:21
anu php
<?php
class Database
{
private static $pgInstance = null;
private \PDO $pdo;
public function __construct($host, $port, $dbname, $user, $password)
{
$dsn = sprintf("pgsql:host=%s;port=%d;dbname=%s", $host, $port, $dbname);
try {
$this->pdo = new \PDO($dsn, $user, $password);
@WahidinAji
WahidinAji / main.go
Last active December 1, 2023 07:07
no description
package main
import (
"fmt"
"time"
)
func main() {
//make a program standby
times := make(chan time.Time)
@WahidinAji
WahidinAji / typesense.sh
Last active November 1, 2023 13:44
running TypeSense on your local machine with docker
#pull the image
docker pull typesense/typesense:0.26.0.rc25
#run you image as containe
#- make sure you are in Documents directory
cd Documents
makdir typesense-data
@WahidinAji
WahidinAji / FromSqlInterpolatedStringHandler.cs
Created May 15, 2023 10:19 — forked from davidfowl/FromSqlInterpolatedStringHandler.cs
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.
@WahidinAji
WahidinAji / multipart_upload.go
Created November 12, 2022 08:17 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@WahidinAji
WahidinAji / clean_code.md
Created November 11, 2022 11:06 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@WahidinAji
WahidinAji / update-golang.md
Created October 24, 2022 14:10 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@WahidinAji
WahidinAji / .zshrc
Created April 1, 2022 17:01 — forked from zanshin/.zshrc
My .zshrc file
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#export ZSH_THEME="robbyrussell"
export ZSH_THEME="zanshin"
@WahidinAji
WahidinAji / curl.md
Created February 6, 2022 07:56 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.