Skip to content

Instantly share code, notes, and snippets.

View htr3n's full-sized avatar

Alex T. htr3n

View GitHub Profile
@htr3n
htr3n / nodejs_base64.js
Created November 4, 2021 21:58
Create an object from a base64 encoded input JSON string in Node.js
const inputStr = ... ; // a base64 encoded string
if (inputStr) {
const decodedStr = Buffer.from(inputStr, 'base64').toString('utf8');
const result = JSON.parse(decodedStr);
if (result) {
// ...
}
}
{
"name": "node-canvas-lambda-container",
"version": "1.0.0",
"dependencies": {
"canvas": "^2.8.0"
},
"license": "MIT"
}
'use strict';
exports.handler = async (event, context, callback) => {
const result = {
body: null,
isBase64Encoded: false,
statusCode: 200
};
console.log('Received a render request event');
try {
@htr3n
htr3n / Dockerfile
Last active October 19, 2021 05:49
node-canvas-lambda-container
FROM public.ecr.aws/lambda/nodejs:14
##
# Install necessary package for building Node.js Canvas
##
RUN yum -y update \
&& yum -y groupinstall "Development Tools" \
&& yum install -y nodejs gcc-c++ cairo-devel libjpeg-turbo-devel pango-devel giflib-devel zlib-devel librsvg2-devel
COPY *.js package* ./
@htr3n
htr3n / wildfly-install.sh
Created April 19, 2021 23:25 — forked from sukharevd/wildfly-install.sh
Script to install JBoss Wildfly 10.x as service in Linux
#!/bin/bash
#title :wildfly-install.sh
#description :The script to install Wildfly 10.x
#more :http://sukharevd.net/wildfly-8-installation.html
#author :Dmitriy Sukharev
#date :2016-06-18T02:45-0700
#usage :/bin/bash wildfly-install.sh
#tested-version1 :10.0.0.CR3
#tested-distros1 :Ubuntu 15.10; Debian 7,8; CentOS 7; Fedora 22
#tested-version2 :10.0.0.Final
@htr3n
htr3n / UuidUtil.java
Created April 19, 2021 04:21
Helper class to work with Java UUID
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.UUID;
/**
* This class provides helper methods to work with UUID, for instance, converting UUID into 16-byte
* array for database column BINARY(16) and vice versa.
*/
public final class UuidUtil
{
@htr3n
htr3n / termite-install.sh
Created August 19, 2019 05:29
Debian/Ubuntu-specific termite installation script
#!/usr/bin/env sh
sudo apt-get install -y \
git \
g++ \
libgtk-3-dev \
gtk-doc-tools \
gnutls-bin \
valac \
intltool \
@htr3n
htr3n / cloudSettings
Last active November 10, 2020 23:43
VSCode/Codium settings
{"lastUpload":"2020-11-10T23:43:02.343Z","extensionVersion":"v3.4.3"}
@htr3n
htr3n / ubuntu-installation.md
Last active January 18, 2023 01:30
Installing and setting a working Ubuntu box

Software Management

Ubuntu/Linux Tools

APT (Ubuntu's Advanced Packaging Tool)

# installing a package
sudo apt install zsh

System

ssh-keygen -t rsa -b 4096 -C "hoang.huy.tran@gmail.com"
  • Windows PowerShell was built upon .NET and only worked on Windows
  • PowerShell Core is open sourced and built on .NET Core 2.x, work on Windows, Linux, macOS, ARM