Skip to content

Instantly share code, notes, and snippets.

View peranakanfrancis's full-sized avatar
🏠
Working from home

MyBetterWeb peranakanfrancis

🏠
Working from home
View GitHub Profile
@peranakanfrancis
peranakanfrancis / gist:c4c7be28db9bfa34d1557489dbf59f89
Created July 18, 2023 03:27
Simple hacks to Convert & Compress media files
### Compress MP4
`ffmpeg -i $INPUT_FILE -c:v libx265 -preset fast -crf 28 -tag:v hvc1 -c:a eac3 -b:a 224k $OUTPUT_FILE`
#! /usr/bin/env python
# Standard library imports.
from SocketServer import ThreadingMixIn
import BaseHTTPServer
import SimpleHTTPServer
import sys
import json
import os
from os.path import (join, exists, dirname, abspath, isabs, sep, walk, splitext,
@peranakanfrancis
peranakanfrancis / bootstrap-clamav.sh
Last active April 20, 2020 09:26
This is an automation install & setup script that does all the job: Install ClamAV from Homebrew. Setup all the required ClamAV files (including configuration). Create two daemons to automatically run clamd and freshclam.
#!/bin/bash
CONFIG_FOLDER=/usr/local/etc/clamav
CLAMD_CONFIG_FILE=$CONFIG_FOLDER/clamd.conf
FRESHCLAM_CONFIG_FILE=$CONFIG_FOLDER/freshclam.conf
DB_FOLDER=/usr/local/var/lib/clamav
RUN_FOLDER=/usr/local/var/run/clamav
LOG_FOLDER=/usr/local/var/log
CLAMD_LOG_FILE=$LOG_FOLDER/clamd.log
CLAMD_ERROR_LOG_FILE=$LOG_FOLDER/clamd.error.log
@peranakanfrancis
peranakanfrancis / dom_script.html
Last active April 29, 2019 07:18
This code will call out a booking calendar of Dom Himalaya Hotel. Use it to embed on any website in a HTML method. The on page loading will take the booking to paypal without leaving the page. A booking receipt will be also shown after transaction is being made.
<!-- Hotel Selector BEGIN-->
<div id="bokun-w51685_5612b9ac_47a7_4201_a62c_3f755c26e455">Loading...</div><script type="text/javascript">
var w51685_5612b9ac_47a7_4201_a62c_3f755c26e455;
(function(d, t) {
var host = 'widgets.bokun.io';
var frameUrl = 'https://' + host + '/widgets/51685?bookingChannelUUID=f728c240-58b6-401d-a724-79b976c23c49&amp;accommodationId=1383&amp;trackingCode=500494d1773e4668a61ee359a6997c30&amp;lang=en&amp;ccy=USD&amp;hash=w51685_5612b9ac_47a7_4201_a62c_3f755c26e455';
var s = d.createElement(t), options = {'host': host, 'frameUrl': frameUrl, 'widgetHash':'w51685_5612b9ac_47a7_4201_a62c_3f755c26e455', 'autoResize':true,'height':'','width':'100%', 'minHeight': 0,'async':true, 'ssl':true, 'affiliateTrackingCode': '500494d1773e4668a61ee359a6997c30', 'transientSession': true, 'cookieLifetime': 43200 };
s.src = 'https://' + host + '/assets/javascripts/widgets/embedder.js';
s.onload = s.onreadystatechange = function() {
var rs = this.readyState; if (rs) if (rs != 'complete') if (
# Usage: python3 shopify2woocommerce.py https://ABC.myshopify.com
# or for interactive mode, just: python3 shopify2woocommerce.py
import json
import os.path
import requests
from collections import OrderedDict
import pandas as pd
from sys import argv, exit
@peranakanfrancis
peranakanfrancis / Jekyll-Vimeo-Plugin.markdown
Last active November 26, 2018 14:57
A plugin for embedding videos from Vimeo using a simple Liquid tag, ie: {% vimeo 12345678 %}.
@peranakanfrancis
peranakanfrancis / ffmpeg4nerd.md
Last active May 26, 2020 19:20
Video editing makes easy with ffmpeg command line

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

/**
* Disable right-click of mouse, F12 key, and save key combinations on page without jeopardy the design of your website.
* By Peranakan Francis (francis.tch@gmail.com)
* https://mybetterweb.site
*/
window.onload = function() {
document.addEventListener("contextmenu", function(e){
e.preventDefault();
}, false);
document.addEventListener("keydown", function(e) {
@peranakanfrancis
peranakanfrancis / vim_keyboard_shortcuts.md
Created February 28, 2018 17:54
vim keyboard shortcuts

quickref.txt For Vim version 8.0. Last change: 2018 Feb 11

	  VIM REFERENCE MANUAL    by Bram Moolenaar

		    Quick reference guide

						 *quickref* *Contents*

tag subject tag subject ~ |Q_ct| list of help files |Q_re| Repeating commands

Keybase proof

I hereby claim:

  • I am peranakanfrancis on github.
  • I am peranakan (https://keybase.io/peranakan) on keybase.
  • I have a public key ASASdjJ5OSH98QC84sDRhQFtUVs-TMCnxd_-aLCcc0gWxwo

To claim this, I am signing this object: