Skip to content

Instantly share code, notes, and snippets.

View dungwinux's full-sized avatar

Nguyễn Tuấn Dũng dungwinux

View GitHub Profile
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@dungwinux
dungwinux / deploy.bat
Created April 6, 2018 08:22
Competitive quick deploy
@echo off
set /p name="Archive Name: "
mkdir %name%
REM VVV Change cpp to file extension you want
copy *.cpp %name%
7z a %name%.zip %name%/
rmdir /S /Q %name%
@dungwinux
dungwinux / makegif.bat
Last active April 21, 2018 06:12
Make gif with ffmpeg and gifski
@echo off
set _excode=
REM Check commands if available
where ffmpeg.exe
set ffmpeg_check=%errorlevel%
where gifski.exe
set gifski_check=%errorlevel%
@dungwinux
dungwinux / tasks.json
Last active July 21, 2018 14:18
VSCode C++ tasks script
{
"version": "2.0.0",
"tasks": [
{
"label": "Build C++17",
"group": "build",
"command": "g++",
"args": [
"-std=c++17",
"-O3",
@dungwinux
dungwinux / rev.cpp
Last active June 14, 2018 08:15
Reverse string
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define _ ;
#define __ int
#define ___ main
#define ____ (
#define _____ )
g++ -CC -P -undef -nostdinc -dDI -E "%1"
g++ -CC -P -undef -nostdinc -dDI -E "$1"

Async/await - Giải thích

  • Chương trình chạy: A cần làm đề cương
  • async: A gửi tin nhắn cho B, nhờ làm hộ đề cương rồi chụp
  • await: A chờ B gửi bài
  • new promise: B hứa sẽ làm đề cương giúp A
    • promise<pending>: B làm đề cương giúp A
    • promise<fulfilled>: B hoàn thành đề cương và chụp vở gửi cho A
  • promise: B không làm đề cương giúp và để lại chữ "seen" cho A
@dungwinux
dungwinux / themisCfg.py
Created March 15, 2019 12:44
Encode and decode Themis config files
import zlib
from sys import argv
def decode(s):
dec = zlib.decompress(s)
res = dec.decode("utf-8")
return res
@dungwinux
dungwinux / themisCfg.js
Created March 23, 2019 02:18
Javascript version of Themis config uncompresser
const zlib = require("zlib");
const fs = require("fs");
function decode(s) {
let dec = zlib.inflateSync(s);
let res = dec.toString("utf8");
return res;
}
function encode(s) {