Skip to content

Instantly share code, notes, and snippets.

@dangduytung
dangduytung / mysql-docker.sh
Created March 13, 2024 09:31 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9
Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0)
@dangduytung
dangduytung / extract_links_web.js
Created July 21, 2022 06:35
Quickly extract all links from a web page using the browser console
@dangduytung
dangduytung / ParseRSAKeys.java
Created May 6, 2022 08:22 — forked from destan/ParseRSAKeys.java
Parse RSA public and private key pair from string in Java
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
@dangduytung
dangduytung / RsaExample.java
Created May 6, 2022 08:10 — forked from nielsutrecht/RsaExample.java
Example of RSA generation, sign, verify, encryption, decryption and keystores in Java
import javax.crypto.Cipher;
import java.io.InputStream;
import java.security.*;
import java.util.Base64;
import static java.nio.charset.StandardCharsets.UTF_8;
public class RsaExample {
public static KeyPair generateKeyPair() throws Exception {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
@dangduytung
dangduytung / interest-housing-bank_2020-08.json
Last active September 1, 2021 15:14
interest-housing-bank_2020-08
[
{
"bank_name": "VIB",
"short_name": "VIB",
"m6": 8.5,
"m12": 10.1
},
{
"bank_name": "MSB",
"short_name": "MSB",
@dangduytung
dangduytung / git-clearHistory
Created August 30, 2021 11:11 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@dangduytung
dangduytung / angular-cli-node-js-typescript-rxjs-compatiblity-matrix.csv
Created August 28, 2021 07:57 — forked from LayZeeDK/angular-cli-node-js-typescript-rxjs-compatiblity-matrix.csv
Angular CLI, Angular, Node.js, TypeScript, and RxJS compatibility matrix. Based on changelogs, metadata, and hands-on experience. Major versions above officially supported versions are not listed. Note that minor TypeScript versions also contain breaking changes.
Angular CLI version Angular version Node.js version TypeScript version RxJS version
1.0.0-beta.17 (package name: angular-cli) 2.0.x 6.9.x or later minor version 2.0.x 5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x
1.0.0-beta.20-1 (package name: angular-cli) 2.1.x 6.9.x or later minor version 2.0.x 5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x
1.0.0-beta.22-1 (package name: angular-cli) 2.2.x 6.9.x or later minor version 2.0.x 5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x
1.0.0-beta.30 2.3.x 6.9.x or later minor version 2.0.x 5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x
1.0.0-rc.4 2.4.x 6.9.x or later minor version 2.0.x 5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x
1.0.6 4.0.x/4.1.x 6.9.x or later minor version 2.2.x 5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x
1.1.3 4.0.x/4.1.x 6.9.x or later minor version 2.3.x 5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x
1.2.7 4.0.x/4.1.x 6.9.x or later minor version 2.3.x 5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x
1.3.2 4.2.x/4.3.x/4.4.x 6.9.x or later minor version 2.4.x 5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x
@dangduytung
dangduytung / research_mongo.md
Created August 17, 2021 08:31 — forked from tuannguyen29/research_mongo.md
Tìm hiểu MongoDB + Mongo Shell

Cài đặt Mongo trên Windows

  1. Download trên trang chủ Mongo, chọn phiên bản phù hợp tại đây.

    Ở đây mình chọn version 4.2.1 (current release). OS: Windows x64 x64.

  2. Sau khi tải về thì chạy file .msi để cài đặt.

    • Cài đặt MongoDB trên Windows như service. Nghĩa là mỗi khi khởi động PC, nó sẽ chạy ngầm như một service trên windows.

    • Sẽ có 2 tuỳ chọn. Ở đây sẽ chọn Run service as Network Service user để kết nối với MongoDB trong tất cả network.

@dangduytung
dangduytung / GmailHelper.java
Created July 22, 2021 07:20 — forked from nutanc/GmailHelper.java
Helper class for Gmail API to send and receive mails
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.auth.oauth2.TokenResponse;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpTransport;