Skip to content

Instantly share code, notes, and snippets.

View nhannt201's full-sized avatar
🎯
Focusing

Nguyễn Trung Nhẫn nhannt201

🎯
Focusing
View GitHub Profile
@jctosta
jctosta / docker-wsl2-memory-limits.md
Created June 14, 2021 21:23
You can limit docker-windows memory usage by adjusting some parameters in wsl2 configuration.

Limit WSL2 Memory Usage when using Docker for Windows

You can limit docker-windows memory usage by adjusting some parameters in wsl2 configuration.

First, close any instances of Docker Windows currently running and create a new file named .wslconfig in your user home directory, like C:\Users<username>:

[wsl2]
memory=4GB
processors=5
@rishitells
rishitells / Jest_GitLab_CI.md
Last active May 3, 2024 20:18
Setting up Jest tests and coverage in GitLab CI

Configuring Jest Tests in GitLab CI

1. Add GitLab CI configuration file in the root

In the root of your project, add .gitlab-ci.yml with the configuration below.

image: node:latest

stages:
@mattiasghodsian
mattiasghodsian / readme.md
Last active May 7, 2024 08:13
How to create a Windows application Installer with NSIS

Nullsoft Scriptable Install System is also known as NSIS open-source system to create Windows application installers. NSIS is a script-based system allowing you to create the logic behind your installer/setup file in a complex way to install tasks. NSIS offers plug-ins and other scripts, for example, to download/install 3rd-party files or communicate with Windows.

The tutorial application

This tutorial will guide you through installing and creating your first Windows installer with Nullsoft Scriptable Install System and how to compile your project. Captura Portable will be used as "our application" for the sake of this tutorial.

Installation

Head to NSIS official site and download the latest release and install it. Run NSIS and you will be welcomed with a menu like below, It's always a good practice to read the Documentation before jumping in t

@chetanppatil
chetanppatil / install-sonar-scanner.sh
Last active December 28, 2023 04:31
Install sonar-scanner in linux mint, ubuntu...
#!/bin/bash
cd /tmp || exit
echo "Downloading sonar-scanner....."
if [ -d "/tmp/sonar-scanner-cli-4.7.0.2747-linux.zip" ];then
sudo rm /tmp/sonar-scanner-cli-4.7.0.2747-linux.zip
fi
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
echo "Download completed."
@brettwold
brettwold / PdfPrint.java
Last active January 2, 2024 03:41
How to save a PDF from any Android WebView
package android.print;
import android.os.CancellationSignal;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import java.io.File;
public class PdfPrint {
@httnn
httnn / gist:b1d772caf76cdc0c11e2
Created April 9, 2015 16:23
Calculate brightness of Android Bitmap
/*
Calculates the estimated brightness of an Android Bitmap.
pixelSpacing tells how many pixels to skip each pixel. Higher values result in better performance, but a more rough estimate.
When pixelSpacing = 1, the method actually calculates the real average brightness, not an estimate.
This is what the calculateBrightness() shorthand is for.
Do not use values for pixelSpacing that are smaller than 1.
*/
public int calculateBrightnessEstimate(android.graphics.Bitmap bitmap, int pixelSpacing) {
int R = 0; int G = 0; int B = 0;
int height = bitmap.getHeight();