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 / nodejs.checksum.js
Created May 25, 2022 10:53 — forked from zfael/nodejs.checksum.js
NODE.JS - How to generate file's Checksum (CRYPTO)
var fs = require('fs');
var crypto = require('crypto');
fs.readFile('file.pdf', function(err, data) {
var checksum = generateChecksum(data);
console.log(checksum);
});
function generateChecksum(str, algorithm, encoding) {
return crypto
@6220119
6220119 / .gitlab-ci.yml
Created May 25, 2022 11:40 — forked from plajjan/.gitlab-ci.yml
Git automation stuff
image: gitlab.dev.terastrm.net:4567/terastream/cisco-nso/ci-cisco-nso:4.2.3
stages:
- build
- mr-robot
variables:
NCS_VERSION: "4.2.3"
DOCKER_REGISTRY: "gitlab.dev.terastrm.net:4567/terastream/cisco-nso"
TARGET_REGISTRY: "repo.dev.terastrm.net:5000/"
@6220119
6220119 / web_socket.js
Created June 4, 2022 16:21 — forked from pragmaticobjects/web_socket.js
Modified web_socket.js
// Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
// License: New BSD License
// Reference: http://dev.w3.org/html5/websockets/
// Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol
(function () {
if (window.WebSocket || window.MozWebSocket) return;
var console = window.console;
if (!console || !console.log || !console.error) {
@6220119
6220119 / WebSockets.md
Created June 4, 2022 16:33 — forked from subudeepak/WebSockets.md
The problems and some security implications of websockets - Cross-site WebSockets Scripting (XSWS)

WebSockets - An Introduction

WebSockets is a modern HTML5 standard which makes communication between client and server a lot more simpler than ever. We are all familiar with the technology of sockets. Sockets have been fundamental to network communication for a long time but usually the communication over the browser has been restricted. The general restrictions

  • The server used to have a permanent listener while the client (aka browser) was not designated any fixed listener for a more long term connection. Hence, every communication was restricted to the client demanding and the server responding.
  • This meant that unless the client requested for a particular resource, the server was unable to push such a resource to the client.
  • This was detrimental since the client is then forced to check with the server at regular intervals. This meant a lot of libraries focused on optimizing asynchronous calls and identifying the response of asynchronous calls. Notably t
@6220119
6220119 / reset.css
Created June 26, 2022 01:50 — forked from EllyLoel/reset.css
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/[email protected]/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
@6220119
6220119 / gist:e4b0b01fbed1c00fc939f7b8d07804ee
Created July 8, 2022 08:54 — forked from jedp/gist:3005816
postMessage() security review checklist

Security-Reviewing Uses of postMessage()

The postMessage() API is an HTML5 extension that permits string message-passing between frames that don't share the same origin. It is available in all modern browsers. It is not supported in IE6 and IE7.

postMessage is generally considered very secure as long as the programmer is careful to check the origin and source of an arriving

import {camelCase, kebabCase, lowerCase, snakeCase, startCase, upperCase, upperFirst} from 'lodash';
export default class StringUtility {
static toCamelCase(str) {
return camelCase(str);
}
static toTitleCase(str) {
return startCase(camelCase(str));
@6220119
6220119 / ColoredShadow.kt
Created December 30, 2022 09:13 — forked from cedrickring/ColoredShadow.kt
Draw a colored shadow in Android Jetpack Compose
/*
Copyright 2020 Cedric Kring.
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
distributed under the License is distributed on an "AS IS" BASIS,
@6220119
6220119 / ChatGPT Stable Diffusion prompts generator.txt
Created April 26, 2023 08:13 — forked from bluelovers/ChatGPT Stable Diffusion prompts generator.txt
using ChatGPT as Stable Diffusion prompts generator
Stable Diffusion is an AI art generation model similar to DALLE-2.
Here are some prompts for generating art with Stable Diffusion.
Example:
- portait of a homer simpson archer shooting arrow at forest monster, front game card, drark, marvel comics, dark, intricate, highly detailed, smooth, artstation, digital illustration
- pirate, concept art, deep focus, fantasy, intricate, highly detailed, digital painting, artstation, matte, sharp focus, illustration
- ghost inside a hunted room, art by lois van baarle and loish and ross tran and rossdraws and sam yang and samdoesarts and artgerm, digital art, highly detailed, intricate, sharp focus, Trending on Artstation HQ, deviantart, unreal engine 5, 4K UHD image
- red dead redemption 2, cinematic view, epic sky, detailed, concept art, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful, trending on artstation
- a fantasy style portrait painting of rachel lane / alison brie hybrid in the style of francois boucher oil painting unreal 5 daz.
# Usage:
# cd Downloads
# sh extract-vsix.sh mvllow.rose-pine-0.3.5
# ^ do not include .vsix
path="$1"
name="$(basename -- $1)"
out_dir=~/.vscode/extensions
tmp_dir=$(mktemp -d -t mvllow-dots)