Skip to content

Instantly share code, notes, and snippets.

View daduam's full-sized avatar

Joseph Ampadu daduam

View GitHub Profile
@pboling
pboling / db_reset.server.ts
Last active August 6, 2025 13:34
Squash PostgreSQL Migrations with drizzle-kit and pgtools
// Author: |7eter l-|. l3oling
// License: MIT
// Copyright: 2024
// See: https://gist.github.com/pboling/f831235a1f3c5627f0341c4bbcf37ea9
// Inspired by https://gist.github.com/RavenHursT/1dd87fb3460183b02ed1cf1dba065de8
/*
Usage:
1. Add pre-requisites:
@thisismydesign
thisismydesign / usePageTracking.js
Last active March 8, 2025 19:23
The ultimate guide to Google Analytics /2
import { useEffect } from "react";
import { useLocation } from "react-router-dom";
export const usePageTracking = () => {
const location = useLocation();
useEffect(() => {
window.gtag("event", "page_view", {
page_path: location.pathname + location.search + location.hash,
page_search: location.search,
@thisismydesign
thisismydesign / google-oauth.controller.ts
Last active March 29, 2025 17:27
OAuth2 in NestJS for social login (Google, Facebook, Twitter, etc) /1
import { Controller, Get, Req, Res, UseGuards } from '@nestjs/common';
import { Request, Response } from 'express';
import { GoogleOauthGuard } from './google-oauth.guard';
@Controller('auth/google')
export class GoogleOauthController {
constructor(private jwtAuthService: JwtAuthService) {}
@Get()
@UseGuards(GoogleOauthGuard)
@sandikodev
sandikodev / gsm-setup.md
Created February 23, 2021 10:07 — forked from heyalexej/gsm-setup.md
SIM Card Management Through GSM Modem On Linux

SIM Card Management Over GSM Modem

A small guide on how to send and receive USSD codes on Linux

I am using the built in GSM (UMTS) modem of my Thinkpad X1 extensively because I am often in places with flaky internet connections. I connect through the standard Network Manager on Ubuntu and everything works fine. There was one major annoyance though. Every time I wanted to top up the SIM balance or book a new package, I needed a phone to send and receive USSD codes. So I took some time to figure out how to do it from the shell. I wrote this down as a help for others and a reminder for myself. Without further ado...

First intsall gammu and picocom.

~  sudo apt-get install -y gammu picocom
@eldadfux
eldadfux / .env
Last active June 29, 2022 05:24
Appwrite 0.14 - Stack
_APP_ENV=production
_APP_LOCALE=en
_APP_OPTIONS_ABUSE=enabled
_APP_OPTIONS_FORCE_HTTPS=disabled
_APP_OPENSSL_KEY_V1=your-secret-key
_APP_DOMAIN=localhost
_APP_DOMAIN_TARGET=localhost
_APP_CONSOLE_WHITELIST_ROOT=enabled
_APP_CONSOLE_WHITELIST_EMAILS=
_APP_CONSOLE_WHITELIST_IPS=
@jesster2k10
jesster2k10 / README.md
Last active July 28, 2025 12:50
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.

I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)

Before trying it out DIY, I considered using:

@silver-xu
silver-xu / ts-boilerplate.md
Last active July 11, 2025 17:36
Setup a Node.js project with Typescript, ESLint, Prettier, Husky

Setup a Node.js project with Typescript, ESLint, Prettier, Husky

1_D8Wwwce8wS3auLAiM3BQKA

Starting a personal node project could be easy; starting a team node project could be challenging.

I am a developer currently working in SEEK Australia.

In my experience, common mistakes developer make when starting a projects are:

  • No Linting
@yizeng
yizeng / .dockerignore
Last active March 11, 2025 15:42
An example .dockerignore file for Rails
.git
.gitignore
# Created by https://www.gitignore.io/api/git,ruby,rails,jetbrains+all
# Edit at https://www.gitignore.io/?templates=git,ruby,rails,jetbrains+all
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
@rao123dk
rao123dk / node_modules.txt
Created August 14, 2019 07:14
delete all node_modules in your system
(A) This command will print out each folder, and even show us how much space the folder is occupying
// Mac / Linux:
find . -name "node_modules" -type d -prune -print | xargs du -chs
//Windows:
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d"
@ivankahl
ivankahl / jacobi.m
Last active April 3, 2024 20:55
The Jacobi method implemented in Octave.
function xnew = jacobi(A, b, xold)
% This is a sample implementation of the Jacobi method in
% Octave.
% We first need to determine how many equations there are
% that we need to solve
n = size(A, 1);
% We create a blank xnew vector to store the final results
xnew = zeros(n, 1);