Skip to content

Instantly share code, notes, and snippets.

@laocoi
laocoi / config.md
Last active June 8, 2024 06:42
Wrangler + SSL + Nginx | Xampp

Wrangler + SSL + Nginx | Xampp

Nginx config

server {
    listen 443 ssl;
    server_name yourdomain.com;

 ssl_certificate /path/to/cert.crt;
@laocoi
laocoi / midjourney-ban-list.json
Created March 21, 2024 01:14 — forked from codepo8/midjourney-ban-list.json
Midjourney banned words
{
"Gore": [
"Blood", "Bloodbath", "Crucifixion", "Bloody", "Flesh", "Bruises", "Car crash", "Corpse", "Crucified", "Cutting", "Decapitate", "Infested", "Gruesome", "Kill (as in Kill la Kill)", "Infected", "Sadist", "Slaughter", "Teratoma", "Tryphophobia", "Wound", "Cronenberg", "Khorne", "Cannibal", "Cannibalism", "Visceral", "Guts", "Bloodshot", "Gory", "Killing", "Surgery", "Vivisection", "Massacre", "Hemoglobin", "Suicide", "Female Body Parts"
],
"Drugs": [
"Drugs", "Cocaine", "Heroin", "Meth", "Crack"
],
"Clothing": [
"no clothes", "Speedo", "au naturale", "no shirt", "bare chest", "nude", "barely dressed", "bra", "risqué", "clear", "scantily", "clad", "cleavage", "stripped", "full frontal unclothed", "invisible clothes", "wearing nothing", "lingerie with no shirt", "naked", "without clothes on", "negligee", "zero clothes"
],
@laocoi
laocoi / colorLog.js
Last active January 6, 2024 18:35
Simple Javascript function to colorize your command-line
function colorLog(text, type, getStr = false){
let str;
switch (type) {
case 'e': // error
str = '\u001b[38;2;255;0;0m'+text+'\u001b[0m'
break;
case 's': // success
str = '\u001b[38;2;0;255;0m'+text+'\u001b[0m'
break;
case 'w': // warning
@laocoi
laocoi / resume.action.js
Created December 30, 2023 17:51 — forked from devAgam/resume.action.js
Sample Function to Automate File Uploads through browser extensions
// This function does the following
// 1. fetches the PDF resume from the url provided
// 2. creates a file object with the resume data
// 3. triggers the change event on the file input element
// 4. the file input element gets the file object
// 5. the file object is uploaded to the website
async function handleResumeInput(remoteResumeURL) {
@laocoi
laocoi / submit.md
Created December 3, 2023 17:17 — forked from tanaikech/submit.md
Downloading and Uploading File to Google Drive without Saving File with Stream and Resumable Upload using Node.js

Downloading and Uploading File to Google Drive without Saving File with Stream and Resumable Upload using Node.js

This is a sample script of Node.js for downloading the data and uploading the data to Google Drive with the resumable upload without saving it as a file. The downloaded data is uploaded to Google Drive with the stream.

Sample script

Before you use this, please set the variables of accessToken, url, fileSize, mimeType and filename. In this case, fileSize is required to set because the data is uploaded with the resumable upload.

const request = require("request");
@laocoi
laocoi / index.ts
Created October 4, 2023 16:24 — forked from pigri/index.ts
Cloudflare worker - Example for Queue scaling
//https://www.npmjs.com/package/round-robin-js
import { RandomRoundRobin } from 'round-robin-js';
async function sender(queue: string, message: any, env: Env) {
try {
const processors = {
PROCESSOR1: env.ENVIRONMENT === 'dev' ? env.PROCESSOR1_DEV : env.PROCESSOR1,
PROCESSOR2: env.ENVIRONMENT === 'dev' ? env.PROCESSOR2_DEV : env.PROCESSOR2,
PROCESSOR3: env.ENVIRONMENT === 'dev' ? env.PROCESSOR3_DEV : env.PROCESSOR3,
PROCESSOR4: env.ENVIRONMENT === 'dev' ? env.PROCESSOR4_DEV : env.PROCESSOR4,
@laocoi
laocoi / remove-empty-google-adsense-ad.js
Last active October 2, 2023 05:03
Remove empty Google Adsense Ads if it is unfilled
var ads = document.querySelectorAll('ins');
ads.forEach(ad => {
const observer = new MutationObserver( mutations =>
{
// console.log(mutations);
mutations.forEach( record =>
{
if(record.type === 'attributes')
{
const attrname = record.attributeName;
@laocoi
laocoi / config.js
Created December 27, 2019 02:59 — forked from codediodeio/config.js
Snippets from the Firestore Data Modeling Course
import * as firebase from 'firebase/app';
import 'firebase/firestore';
var firebaseConfig = {
// your firebase credentials
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
@laocoi
laocoi / vietnamese-slug.js
Last active May 28, 2024 14:54
Create Vietnamese slug from string - Javascript
function slugify(string){
const a = 'àáäâãåăæąçćčđďèéěėëêęğǵḧìíïîįłḿǹńňñòóöôœøṕŕřßşśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;'
const b = 'aaaaaaaaacccddeeeeeeegghiiiiilmnnnnooooooprrsssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/á|à|ả|ạ|ã|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ/gi, 'a')
.replace(/é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ/gi, 'e')
.replace(/i|í|ì|ỉ|ĩ|ị/gi, 'i')
.replace(/ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ/gi, 'o')
.replace(/ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự/gi, 'u')
@laocoi
laocoi / svg-viewer.php
Created May 27, 2019 10:57 — forked from AlekVolsk/svg-viewer.php
SVG viewer
<?php
$list = [];
$err = '';
$path = filter_input( INPUT_GET, 'path');
if ( !$path )
{
$err = 'Path is empty';