Skip to content

Instantly share code, notes, and snippets.

View xnohat's full-sized avatar
💭
Coding like machine

Hong Phuc Nguyen xnohat

💭
Coding like machine
View GitHub Profile
@xnohat
xnohat / install_docker_in_colab.sh
Created June 13, 2022 20:00 — forked from mwufi/install_docker_in_colab.sh
Install Docker in Google Colab!
# First let's update all the packages to the latest ones with the following command
sudo apt update -qq
# Now we want to install some prerequisite packages which will let us use HTTPS over apt
sudo apt install apt-transport-https ca-certificates curl software-properties-common -qq
# After that we will add the GPG key for the official Docker repository to the system
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# We will add the Docker repository to our APT sources
var express = require('express');
var passport = require('passport');
var Strategy = require('passport-openidconnect').Strategy;
// Configure the OpenID Connect strategy for use by Passport.
//
// OAuth 2.0-based strategies require a `verify` function which receives the
// credential (`accessToken`) for accessing APIs on the user's behalf, along
// with the user's profile. The function must invoke `cb` with a user object,
@xnohat
xnohat / index.js
Created March 20, 2022 12:27 — forked from pinkhominid/index.js
Upload a file with node-fetch and form-data
const fs = require('fs');
const fetch = require('node-fetch');
const FormData = require('form-data');
const filePath = `path/to/file.ext`;
const form = new FormData();
const stats = fs.statSync(filePath);
const fileSizeInBytes = stats.size;
const fileStream = fs.createReadStream(filePath);
form.append('field-name', fileStream, { knownLength: fileSizeInBytes });
@xnohat
xnohat / debugger pause beforeunload
Created January 17, 2022 19:49 — forked from carcinocron/debugger pause beforeunload
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@xnohat
xnohat / rearct-native-app-in-wsl2.md
Created December 22, 2021 15:24 — forked from bergmannjg/rearct-native-app-in-wsl2.md
Building a react native app in WSL2
@xnohat
xnohat / app-search-cli-xxl
Created November 23, 2021 18:32 — forked from haynesgt/app-search-cli-xxl
App Search CLI for super-large newline-delimited json
#!/usr/bin/env node
/**
* Install:
*
* Download this file and give it executuable persmissions
*
* Usage:
*
* Uploading documents
@xnohat
xnohat / app-search-cli
Created November 23, 2021 18:32 — forked from JasonStoltz/app-search-cli
App Search CLI
#!/usr/bin/env node
/**
* Install:
*
* Download this file and give it executuable persmissions
*
* Usage:
*
* Uploading documents
a
ai
am
an
ang
anh
ao
au
ay
ba
@xnohat
xnohat / all-vietnamese-syllables.txt
Created October 16, 2021 11:08 — forked from hieuthi/all-vietnamese-syllables.txt
All possibly existent Vietnamese syllables, created by combine all onsets with all rimes. More information can be found at: http://hieuthi.com/blog/2017/03/21/all-vietnamese-syllables.html
a
ai
am
an
ang
anh
ao
au
ay
ba
@xnohat
xnohat / auto_partition_manager.sql
Last active September 9, 2021 17:19 — forked from CodMonk/CodeMonk_Part#Man.sql
MySQL Stored Procedure for Table Partitioning
DELIMITER //
DROP PROCEDURE IF EXISTS `auto_partition_manager`;
CREATE DEFINER = `root` @`localhost` PROCEDURE `auto_partition_manager`(
in partition_frequency varchar(100),
in db_schema varchar(100),
in input_table_name varchar(100),
in partition_column varchar(100)
) BEGIN -- Author - Code Monk