Skip to content

Instantly share code, notes, and snippets.

@sanjinso
sanjinso / avrdude-flash.sh
Created August 14, 2024 06:28 — forked from nooges/avrdude-flash.sh
Script for flashing .hex file onto Pro Micro with avrdude
#!/usr/bin/env bash
MCU=atmega32u4
if grep -q -s Microsoft /proc/version; then
echo 'ERROR: Pro Micros can not be flashed within the Windows Subsystem for Linux (WSL) currently. Instead, take the .hex file generated and flash it using AVRDUDE, AVRDUDESS, or XLoader.'
exit 1
fi
if [ "$#" -ne 1 ]; then
@sanjinso
sanjinso / README.md
Created April 2, 2024 21:31 — forked from ErykDarnowski/README.md
How to automatically mount network a Samba share on Arch Linux!

How to automatically mount network a Samba share on Arch Linux!

  1. Install the [cifs-utils][1] package: sudo pacman –S cifs-utils.
  2. Make a mount folder for the SMB share: sudo mkdir /mnt/<Path>.
  3. Create a backup of the [fstab][2] file (just in case): sudo cp /etc/fstab /etc/fstab_backup.
  4. Open the [fstab][2] file in your favorite editor: sudo vim /etc/fstab.
  5. Add the mount line: //<Server_address>/<Server_share_and_internal_path> /mnt/<Path> cifs username=<Server_user>,pass=<Server_password> 0 0.
  1. Save the file.
  2. Reload [fstab][2]: sudo mount -av.
@sanjinso
sanjinso / main.sh
Created September 8, 2023 08:40
[Make a symlink in Windows with CMDER] #cmder
# mklink /j <directory/shortcut name> <directory to create the link to>
mklink /j OPUSConfirmationsTrunk_v2.0 C:\Users\grobles4\workspace\OPUSConfirmationsTrunk_v2.0
@sanjinso
sanjinso / functions.php
Created August 28, 2023 13:07
[Wordpress: Add SVG Support Media Library] #wordpress
// Allow SVG
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
global $wp_version;
if ( $wp_version !== '4.7.1' ) {
return $data;
}
$filetype = wp_check_filetype( $filename, $mimes );
@sanjinso
sanjinso / functions.php
Created August 28, 2023 13:06
[Wordpress: Add Genesis Block Editor for Widgets] #wordpress
//* Enable the block-based widget editor
add_filter( 'use_widgets_block_editor', '__return_true' );
@sanjinso
sanjinso / functions.php
Created August 27, 2023 17:49
Wordpress: Cache Buster by adding Custom CSS #wordpress
/* Start Cache Busting with custom style.css*/
$version = defined( 'CHILD_THEME_VERSION' ) && CHILD_THEME_VERSION ? CHILD_THEME_VERSION : PARENT_THEME_VERSION;
$version .= '.' . date ( "njYHi", filemtime( get_stylesheet_directory() . '/css/global-style.css' ) );
wp_enqueue_style( 'global-style', get_stylesheet_directory_uri() . '/css/global-style.css', array(), $version );
/* End Cache Busting */
@sanjinso
sanjinso / chmod.bash
Last active January 25, 2022 15:27
[VestaCP: Fix File Permissions] #server #vestacp
#!/bin/bash
# info: CHMOD & Ownership FIX
# options: NO OPTIONS
#
# The function fixes chmod and ownership permissions for all websites
#!/bin/bash
for i in `$VESTA/bin/v-list-sys-users | awk '{if(NR>2)print}'`; do
find /home/$i/web/ -name 'public_*html' -type d -print0 | xargs -0 -I {} find '{}' -type f -print0 | xargs -0 -I {} chmod 0644 {};
@sanjinso
sanjinso / functions.php
Last active May 16, 2021 08:57
[Wordpress: Deactivate Image Compression] #wordpress
/**
* Deactivate File Compression when uploading
*/
add_filter('jpeg_quality', function($arg){return 100;});
add_filter( 'wp_editor_set_quality', function($arg){return 100;} );
@sanjinso
sanjinso / wp-config.php
Last active February 21, 2021 17:17 — forked from MikeNGarrett/wp-config.php
[Wordpress: Wp-Config Constants] #wordpress
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@sanjinso
sanjinso / functions.php
Last active February 21, 2021 17:14 — forked from mattclements/function.php
[Wordpress: Disable Comments] #wordpress
<?php
/**
* Disables comments, Add below to existing function.php file.
*/
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {