Skip to content

Instantly share code, notes, and snippets.

View 6220119's full-sized avatar
🌴

Nguyen Vu Cuong (Ralph) 6220119

🌴
View GitHub Profile
@6220119
6220119 / list-of-curl-options.txt
Created February 22, 2022 09:44 — forked from eneko/list-of-curl-options.txt
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@6220119
6220119 / main.go
Created November 29, 2021 04:30 — forked from dopey/main.go
How to generate secure random strings in golang with crypto/rand.
package main
import (
"crypto/rand"
"encoding/base64"
"fmt"
"io"
"math/big"
)
@6220119
6220119 / react-teleporter.tsx
Created September 22, 2021 10:21
sample render-props vs react-teleporter
import { createTeleporter } from "react-teleporter";
const HeaderTitleSlot = createTeleporter();
const HeaderActionsSlot = createTeleporter();
const AppLayout = ({ children: content }) => {
return (
<>
<Sidebar />
<Header>
@6220119
6220119 / naming.md
Created February 17, 2021 11:32 — forked from tmcw/naming.md
Naming

Naming things in programming is pretty hard. It's not impossible, though. Here are some guidelines I usually follow.

Avoid weasel words

Wikipedia's article about weasel words is incredible. In this context I mean words like this:

  • Data
  • Process
  • Run
  • Do
@6220119
6220119 / LICENSE.txt
Created January 22, 2021 03:08 — forked from xem/LICENSE.txt
Challenge: Executing more than 140 JS characters in a tweet!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@6220119
6220119 / gcrgc.sh
Created December 11, 2020 09:11 — forked from ahmetb/gcrgc.sh
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@6220119
6220119 / github-actions-ranking.md
Created October 25, 2020 23:56 — forked from alekseykulikov/github-actions-ranking.md
Github Actions Ranking (June 18, 2020)

Github Actions is a CI/CD platform that gained a lot of popularity recently. I participated in building ⭐️ Lighthouse CI Action and was curious how well it performs.

But Github Marketplace UI shows no ranking information. Essentially, It's a search with random results; at least, I don't understand the order. I couldn't find ⭐️ Lighthouse CI Action in Continuous integration category after browsing 50 available pages (Each page shows 20 results, so it's possible to see only 1000 results, but CI category has 1469 😐).

I decided to build a custom script that crawls all categories and use Github Search (example query) to estimate usa

@6220119
6220119 / bash-path-vars
Created September 16, 2020 12:10 — forked from caruccio/bash-path-vars
Path manipulation with bash vars
$ FILE=/some/path/to/file.txt
###################################
### Remove matching suffix pattern
###################################
$ echo ${FILE%.*} # remove ext
/some/path/to/file
$ FILE=/some/path/to/file.txt.jpg.gpg # note various file exts
@6220119
6220119 / type_runtime.dart
Last active September 12, 2020 11:02
Dart type info at runtime
void main() {
const sampleMap = <String, dynamic>{
'key': 'value',
'anotherKey': 6220119,
};
print(sampleMap is Map);
// [output]: true
print(sampleMap is Map<dynamic, dynamic>);
// [output]: true
print(sampleMap is Map<String, dynamic>);
- final data = platformChannel.invokeMethod<Map<String, dynamic>>('getData', arguments);
+ final data = platformChannel.invokeMethod<Map>('getData', arguments);
or
+ final data = platformChannel.invokeMethod<Map<dynamic, dynamic>>('getData', arguments);