Skip to content

Instantly share code, notes, and snippets.

Work From Home

Thiên Toán toanalien

Work From Home
View GitHub Profile
marcosvpj /
Last active Dec 10, 2021
How to remove duplicate lines in Visual Studio Code?

If the order of lines is not important##

Sort lines alphabetically, if they aren't already, and perform these steps:
(based on this related question:

  1. Control+F

  2. Toggle "Replace mode"

  3. Toggle "Use Regular Expression" (the icon with the .* symbol)

jmprusi /
Last active Jun 10, 2020
Install openresty on centos.
cat <<'EOF' > /etc/yum.repos.d/OpenResty.repo
name=Official OpenResty Repository
# Expects Ubuntu 16.06 (xenial) and kernel 4.x.
# Based upon a blog post by Zach at
set -eux
# Have the user call sudo early so the credentials is valid later on
sudo whoami
mesgarpour / appsScript_ListFilesFolders_ver.2.js
Last active Jan 25, 2022
[Google Apps Script] List all files & folders in a Google Drive folder, & write into a speadsheet
View appsScript_ListFilesFolders_ver.2.js
* Copyright 2017 Mohsen Mesgarpour
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
Restuta /
Last active Jan 21, 2022
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan  4 22:03 angular2.min.js
jquense / 0.
Last active Nov 1, 2021
Alternative ways to define react Components
View 0.

The 0.13.0 improvements to React Components are often framed as "es6 classes" but being able to use the new class syntax isn't really the big change. The main thing of note in 0.13 is that React Components are no longer special objects that need to be created using a specific method (createClass()). One of the benefits of this change is that you can use the es6 class syntax, but also tons of other patterns work as well!

Below are a few examples creating React components that all work as expected using a bunch of JS object creation patterns ( All of the examples are of stateful components, and so need to delegate to React.Component for setState(), but if you have stateless components each patterns tends to get even simpler. The one major caveat with react components is that you need to assign props and context to the component instance otherwise the component will be static. The reason is

bigsnarfdude / gist:b2eb1cabfdaf7e62a8fc
Last active Mar 8, 2021
ubuntu 14.04 install scala 2.11.7 and sbt 13.9 and java 8 and git
View gist:b2eb1cabfdaf7e62a8fc
# scala install
sudo dpkg -i scala-2.11.7.deb
# sbt installation
echo "deb /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp:// --recv 642AC823
sudo apt-get update
sudo apt-get install sbt
staltz /
Last active Jan 25, 2022
The introduction to Reactive Programming you've been missing
soheilhy /
Last active Jan 25, 2022
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for,, and on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

jmvrbanac /
Last active Jan 4, 2022
Install pyenv on Ubuntu
sudo apt-get install git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl
sudo pip install virtualenvwrapper
git clone ~/.pyenv
git clone ~/.pyenv/plugins/pyenv-virtualenvwrapper
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc