Skip to content

Instantly share code, notes, and snippets.

View jesselau76's full-sized avatar

jesselau76

View GitHub Profile
@jesselau76
jesselau76 / hls.sh
Created November 8, 2024 23:05 — forked from stenuto/hls.sh
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import inch
from reportlab.pdfgen import canvas
def split_text_into_chunks(text, num_chunks):
"""Split the text into specified number of chunks."""
lines_per_chunk = len(text) // num_chunks
return [text[i * lines_per_chunk:(i + 1) * lines_per_chunk] for i in range(num_chunks - 1)] + [text[(num_chunks - 1) * lines_per_chunk:]]
@jesselau76
jesselau76 / input-dropdown.html
Created October 24, 2018 20:29
Add dropdown function with hot searches on search bar
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
font-family: Arial;
}
@jesselau76
jesselau76 / style.css
Last active October 14, 2018 05:30
Extra-child theme - place a search bar on primary menu bar center
/*
Theme Name: Extra Child
Template: Extra
*/
/* =Theme customization starts here
------------------------------------------------------- */
@media (min-width: 1025px) {
#main-header .et-top-search {
<?php
$q = $_GET['q'];
$sort = $_GET['sort'];
$manticore = new mysqli("127.0.0.1", "", "", "", 9306);
$q=$manticore->real_escape_string($q);
if ($sort=="1")
{
$sphinxQl="SELECT * ,SNIPPET(body,'".$q."','limit=100') as snippet FROM idx_blog WHERE MATCH('".$q."')";
}
<p>Manticore Search: <input id="manticoresearch" name="search" type="text" /><br />
<button type="button" onclick="displaysort()">Manticore Search</button></p>
<div id="sort" style="display: none;">
<form>
<select name="users" id="sortoption" onchange="search(this.value)">
<option value="1">Sorting by:</option>
<option value="1">Relevance</option>
<option value="2">Latest Date</option>
</select>
</form>
@jesselau76
jesselau76 / hotnumber.html
Last active September 30, 2018 21:41
Add to wordpress widget
<style>
#hotnum {
border-radius: 5px;
cursor: pointer;
transition: 0.3s;
}
#hotnum:hover {opacity: 0.7;}
<?php
/**
* Plugin Name: Find and Replace TEXT
* Plugin URI: https://jesselau.com
* Version: 2.0
* Author: jesse Lau
* Author URI: https://jesselau.com
* Description: Add find and replace function in WordPress editor in both visual and text mode.
* License: GPL2
*/
@jesselau76
jesselau76 / find-and-replace-text-mode.php
Last active September 24, 2018 22:35
Find And Replace Text Mode, a Wordpress Plugin. Add find and replace function in WordPress editor text mode.
<?php
/**
* Plugin Name: Find and Replace Text Mode
* Plugin URI: http://jesselau.com
* Version: 1.0
* Author: jesse Lau
* Author URI: https://jesselau.com
* Description: Add find and replace function in WordPress editor text mode.
* License: GPL2
*/
@jesselau76
jesselau76 / index.php
Created September 18, 2018 21:54
Divi index.php change to display readmore link on search and tag pages.
<?php get_header(); ?>
<div id="main-content">
<div class="container">
<div id="content-area" class="clearfix">
<div id="left-area">
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
$post_format = et_pb_post_format(); ?>