Skip to content

Instantly share code, notes, and snippets.

View alexjyong's full-sized avatar

Alex Yong alexjyong

View GitHub Profile
@alexjyong
alexjyong / base64Html.js
Last active April 13, 2023 12:54
Converts an html page with image links to an html page with base64 links in node.js
const fs = require('fs');
const request = require('request');
const { JSDOM } = require('jsdom');
const $ = require('jquery');
const pretty = require('pretty');
function convertImagesToBase64(inputFile, outputFile) {
fs.readFile(inputFile, 'utf8', (err, htmlContent) => {
if (err) throw err;
@alexjyong
alexjyong / base64Html.py
Last active April 14, 2023 18:59
Converts an html page with image links to an html page with base64 links in python
import sys
import base64
import requests
from bs4 import BeautifulSoup
def convert_images_to_base64(input_file, output_file):
with open(input_file, 'r', encoding='utf-8') as f:
html_content = f.read()
soup = BeautifulSoup(html_content, 'html.parser')
@alexjyong
alexjyong / pasteEnabler.js
Created January 6, 2023 14:51
Renable paste on web pages that block it
var allowPaste = function(e){
e.stopImmediatePropagation();
return true;
};
document.addEventListener('paste', allowPaste, true);
@alexjyong
alexjyong / slackExample.js
Created December 21, 2022 21:23
nodeJS slack talk example
//this uses node version 16.15.0
import { WebClient } from '@slack/web-api';
// An access token (from your Slack app or custom integration - xoxp, xoxb)
const token = "SuperSecretToken";
const web = new WebClient(token);
// This argument can be a channel ID, a DM ID, a MPDM ID, or a group ID
@alexjyong
alexjyong / VLCPlayFromYoutube.txt
Last active April 21, 2022 19:40
VLC play from youtube
alias youtube='vlc -I rc --vout none --quiet'
#example usage
# youtube https://www.youtube.com/watch?v=Rl4RFIPLrew
@alexjyong
alexjyong / catdrawer-youtube-to-gif-README.md
Last active August 30, 2023 13:32 — forked from dannguyen/catdrawer-youtube-to-gif-README.md
Using youtube-dl and gifify from the command-line to make a cat gif
@alexjyong
alexjyong / some perl command
Created March 11, 2022 17:04
perl oneliner to filter CLI output
perl -wnE'say /<add a regex here>/g'
example: docker inspect --format='{{index .RepoDigests 0}}' superCoolTag | perl -wnE'say /sha256.*/g'
this would output only the sha256 of the image.
'use strict';
const puppeteer = require('puppeteer');
const createCsvWriter = require('csv-writer').createObjectCsvWriter;
async function main() {
var entries=[];//store all the food pantry data;
//headless so i can see what this badboy is doing
const browser = await puppeteer.launch({