Skip to content

Instantly share code, notes, and snippets.

View dexter4life's full-sized avatar
💭
I may be slow to respond.

Peter Nwanosike dexter4life

💭
I may be slow to respond.
  • Philippines
View GitHub Profile
@dexter4life
dexter4life / print.cc
Created January 3, 2026 01:27
Print tuple in c++
template <typename Tuple> void print_tuple(const Tuple& t)
{
return [&]<std::size_t... Is>(std::index_sequence<Is...>) {
((std::cout << (Is == 0 ? "" : ", ") << std::get<Is>(t)), ...);
}(std::make_index_sequence<std::tuple_size_v<Tuple>>());
}
@dexter4life
dexter4life / gist:2ebf3b4705107e552cbbd6ac895cb511
Last active December 20, 2025 01:49
Getting struct or class name in c++
#include <typeinfo>
#include <cxxabi.h>
template <typename T> struct ClassName
{
ClassName(T& obj) : _obj(obj) {}
std::string getClassName() const
{
int status = 0;
// __cxa_demangle returns a pointer to a malloc'ed buffer
mkdir ~/l && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C ~/l
eval "$(~/l/bin/brew shellenv)"
brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"
package des.c5inco.cardswipecompose
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.calculateTargetValue
import androidx.compose.animation.core.keyframes
import androidx.compose.animation.splineBasedDecay
@dexter4life
dexter4life / build-static-v8-libs.sh
Created May 25, 2024 13:34 — forked from skizhak/build-static-v8-libs.sh
Build and generate static v8 library
#Run build-v8.sh to setup deps.
gn gen "--args=is_clang=true is_component_build=false v8_static_library=true use_custom_libcxx=false target_cpu=\"x64\"" out.gn/x64.Release
ninja -C out.gn/x64.Release/
@dexter4life
dexter4life / docker-compose.yml
Created February 20, 2024 14:20 — forked from analogic/docker-compose.yml
Poste.io (with Lets Encrypt) + Nginx reverse proxy + Nginx Lets encrypt companion
version: '3'
services:
nginx-proxy:
image: jwilder/nginx-proxy
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
container_name: nginx-proxy
restart: unless-stopped
ports:
@dexter4life
dexter4life / Common-Currency.json
Created March 19, 2023 12:28 — forked from ksafranski/Common-Currency.json
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@dexter4life
dexter4life / gist:8fd522e32567be5167509a6659fb138f
Created June 12, 2021 12:26 — forked from jrmadsen67/gist:bd0f9ad0ef1ed6bb594e
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
@dexter4life
dexter4life / generate-certificates.sh
Created October 7, 2020 20:31
Generate self-signed ssl certificates.
#!/bin/bash
# set values for certificate DNs
# note: CN is set to different values in the sections below
ORG="000_Test_Certificates"
# set values that the commands will share
VALID_DAYS=360
CA_KEY=ca.key
CA_CERT=ca.crt