Skip to content

Instantly share code, notes, and snippets.

View hucancode's full-sized avatar
🐼

Bang Nguyen Huu hucancode

🐼
View GitHub Profile
@hucancode
hucancode / README.md
Last active January 18, 2024 03:57
Flatten Strapi 4's response JSON

Update 29/11/2022

There is a plugin on Strapi Marketplace that do this response transforming stuffs in a more configurable way. Checkout this if you are interested.

@hucancode
hucancode / facebook-screencast.sh
Last active April 24, 2022 09:03
Cast your screen to Facebook Live. Require `ffmpeg`, `xrandr`, `x11grab`, an audio driver (default to `pulse`)
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo "Usage: $0 <API_KEY> [AUDIO_SOURCE_NAME] [OUTPUT_WIDTH]";
exit 0;
fi
AUDIO_SOURCE_NAME=${2:-pulse};
ALL_AUDIO=$(ffmpeg -sources alsa | while read -r line; do echo -e $(echo "$line" | cut -d ' ' -f1)" "; done);
AUDIO_SOURCE_FOUND=$(echo $ALL_AUDIO | grep $AUDIO_SOURCE_NAME);
if [ -z "${AUDIO_SOUCE_FOUND}" ]; then
echo -e "Can't find audio source $AUDIO_SOURCE_NAME, please select 1 from:\n$ALL_AUDIO";
@hucancode
hucancode / docker-compose.yml
Created April 23, 2022 01:36
Load balancer example with Docker
version: "3"
services:
db:
image: postgres:latest
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
# ... other environment variables
my-service:
@hucancode
hucancode / remove-all-containers.sh
Last active April 24, 2022 09:07
Docker useful commands
docker rm $(docker container ls -qa)
@hucancode
hucancode / Dockerfile
Last active April 28, 2022 05:35
Setup NodeJS/MySQL with Docker
# Use the official lightweight Node.js 16 image.
# https://hub.docker.com/_/node
FROM node:16-slim
WORKDIR /app
COPY . ./
RUN npm ci && npm run build
@hucancode
hucancode / ue-build-linux.fish
Created May 25, 2022 04:20
UE5 build current project
#!/usr/bin/env fish
set ubt /unreal/5/UnrealEngine/Engine/Build/BatchFiles/Linux/Build.sh
set prj (fd -d 1 -t f -e uproject)
if test -z "$prj"
return 1
end
set target (echo $prj | sd / . | rev | cut -f 2 -d . | rev)
$ubt {$target}Editor Linux Development $PWD/$prj -waitmutex
@hucancode
hucancode / resume.json
Last active May 31, 2022 05:31
My Resume
{
"basics":{
"name":"Bang Nguyen Huu",
"label":"Front End Developer",
"image":"https://github.com/hucancode.png",
"summary":"I’m a a passionate Front End Software Engineer. I build mobile applications and games for a living.",
"website":"https://hucanco.de",
"email":"hucancode@gmail.com",
"location":{
"city":"Takamatsu",
@hucancode
hucancode / create-db.sh
Last active June 2, 2022 01:03
Create a database and an user associated with it
mysql -uroot -p -e "CREATE DATABASE mydb;CREATE USER myuser@'%' IDENTIFIED BY 'secret';GRANT ALL PRIVILEGES ON mydb.* TO myuser@'%';"
<link href="https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700&display=swap" rel="stylesheet" />
<div class="flex h-screen w-full flex-col justify-center bg-gray-800 p-10">
<div class="rounded-lg bg-gradient-to-r from-green-200 via-yellow-500 to-blue-300 p-px">
<div class="flex flex-col items-start justify-center gap-3 rounded-lg bg-gray-800 p-9 lg:flex-row">
<div>
<span class="font-cinzel bg-gradient-to-r from-teal-200 to-blue-300 bg-clip-text font-bold uppercase text-transparent">Wakanda forever</span>
<span class="ml-2">🦁</span>
</div>
<p class="text-gray-400">This is something you should consider to notice because it's so cool</p>
</div>
@hucancode
hucancode / backdrop.css
Created June 18, 2022 11:15
Give backdrop to element without wrapping it in an extra div
.modal::backdrop {
background: rgb(0 0 0 / 0.5);
}