Skip to content

Instantly share code, notes, and snippets.

@tripflex
tripflex / functions.php
Last active June 26, 2024 04:57
Fix Select2 issues with WordPress Admin Bar
<?php
add_action( 'wp_head', 'smyles_output_select2_admin_bar_fix' );
function smyles_output_select2_admin_bar_fix() {
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type = "text/css"';
/**
* We use ~ here instead of + for any situations where something else ends up attaching to body as well
*/
?>
<style<?php echo $type_attr; ?> media="screen">
#!/bin/bash
for listfile in /var/lib/dpkg/info/*.list.broken; do
#echo ${listfile##*/}
listfilename=$(basename -- "$listfile")
listfilename="${listfilename%.*}"
echo "list file name: ${listfilename}"
if [ -f "/var/lib/dpkg/info/${listfilename}" ]; then
output=$(file "/var/lib/dpkg/info/${listfilename}" | awk '{print $2}')
echo $output
#break
#!/bin/bash
for listfile in /var/lib/dpkg/info/*.list; do
listfilename=$(basename -- "$listfile")
listfilename="${listfilename%.*}"
echo ${listfilename}
#break
output=$(file ${listfile}| awk '{print $2}')
#echo "${output}"
if [[ $output == *"data"* ]]; then
echo "${listfile} is DATA!"
@nzec
nzec / README.MD
Last active March 21, 2025 09:29
DeezLoader Offical Page

Thanks to /u/zpoo32 for reporting several issues in this list!

Deemix

  • deemix: just the cli and the library
  • deemix-pyweb: the app with a GUI
  • deemix-server: just the server part of deemix-pyweb
@2E0PGS
2E0PGS / linux-usb-file-copy-fix.md
Last active February 20, 2025 20:55
Fix Ubuntu and other Linux slow/hanging file copying via USB.

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

I suggest you edit your /etc/rc.local file to make this change persistant across reboots.

sudo nano /etc/rc.local

@2E0PGS
2E0PGS / gigabyte-usb3-fix.md
Last active January 2, 2025 19:57
GIGABYTE GA-970A-DS3 USB3 fix for Ubuntu x64

Ok so for anyone with "GIGABYTE GA-970A-DS3" I have done alot of testing and research. The best config I found to get USB3 working is this:

Edit Grub config:

sudo nano /etc/default/grub

Edit the line that looks like this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

@lightonphiri
lightonphiri / bash-install_google_fonts_on_ubuntu.md
Last active April 4, 2025 23:39
Install Google Fonts on Ubuntu

Install Google Fonts

Download desired fonts

https://fonts.google.com/?selection.family=Open+Sans

Install Google Fonts on Ubuntu

cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
sudo unzip -d . ~/Downloads/Open_Sans.zip

@julianxhokaxhiu
julianxhokaxhiu / pagespeed_optimize_images.sh
Last active December 7, 2024 21:46
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
#!/bin/bash
# Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
find . -type f -iname "*.png" -exec optipng -nb -nc {} \;
find . -type f -iname "*.png" -exec advpng -z4 {} \;
find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \;
<?php
function cmb_opt_groups( $args, $defaults, $field_object, $field_types_object ) {
// Only do this for the field we want (vs all select fields)
if ( '_cmb_option_field' != $field_types_object->_id() ) {
return $args;
}
$option_array = array(
'Group 1' => array(
@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active August 1, 2024 04:14
WP: Insert attachment from URL
<?php
/**
* Insert an attachment from a URL address.
*
* @param string $url The URL address.
* @param int|null $parent_post_id The parent post ID (Optional).
* @return int|false The attachment ID on success. False on failure.
*/
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) {