Skip to content

Instantly share code, notes, and snippets.

@ijprest
ijprest / tohex.bat
Created September 10, 2011 02:07
CMD Batch file conversion of a decimal number to hex
@echo off & setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set LOOKUP=0123456789abcdef &set HEXSTR=&set PREFIX=
if "%1"=="" echo 0&goto :EOF
set /a A=%* || exit /b 1
if !A! LSS 0 set /a A=0xfffffff + !A! + 1 & set PREFIX=f
:loop
set /a B=!A! %% 16 & set /a A=!A! / 16
set HEXSTR=!LOOKUP:~%B%,1!%HEXSTR%
if %A% GTR 0 goto :loop
echo %PREFIX%%HEXSTR%
@jadeatucker
jadeatucker / HOWTODMG.md
Last active July 10, 2024 23:35
How to create a "DMG Installer" for Mac OS X

Creating a "DMG installer" for OS X

A DMG Installer is convenient way to provide end-users a simple way to install an application bundle. They are basically a folder with a shortcut to the Applications directory but they can be customized with icons, backgrounds, and layout properties. A DMG file (.dmg) is a Mac OS X Disk Image file and it is used to package files or folders providing compression, encryption, and read-only to the package.

##Creating the DMG file #Disk Utility

@JamesChevalier
JamesChevalier / mac_utf8_insanity.md
Last active June 16, 2024 13:44
Unicode on Mac is insane. Mac OS X uses NFD while everything else uses NFC. This fixes that.

convmv manpage

Install convmv if you don't have it

sudo apt-get install convmv

Convert all files in a directory from NFD to NFC:

convmv -r -f utf8 -t utf8 --nfc --notest .

@woodwardtw
woodwardtw / tellmeyoursecrets.js
Last active June 9, 2023 02:40
google script that lists a lot of info about the files in a particular folder/sub folder structure including viewers, editors, and sharing permissions
function listFolders(folder) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]); //writes the headers
var folder = DriveApp.getFolderById("YOUR_FOLDER_ID");//that long chunk of random numbers/letters in the URL when you navigate to the folder
var files = folder.getFiles();//initial loop on loose files w/in the folder
var cnt = 0;
var file;
@joshschmelzle
joshschmelzle / ffmpeg-cut-out-video.cmd
Created November 29, 2016 18:17
Cut a video without re-encoding with ffmpeg
ffmpeg -i input.mp4 -c copy -ss 00:04:25.000 -to 00:09:25.000 output.mp4
#!/usr/bin/php
<?php
declare(strict_types = 1);
// require_once ('hhb_.inc.php');
hhb_init ();
if ($argc !== 3) {
fprintf ( STDERR, "usage: %s timestamp url\n", $argv [0] );
fprintf ( STDERR, "example: %s 20091012061648 http://www.p4w.se\n", $argv [0] );
die ( 1 );
}
<?php
$wrappers = array(
array(
'wrapper_id' => 'wrapper-1511378776546-9087',
'fields' => array(
array(
'element_id' => 'name-1',
'type' => 'name',
'cols' => '12',
@bappi-d-great
bappi-d-great / code.php
Created July 4, 2018 08:23
Use country list in forminator
<?php
add_filter( 'forminator_field_single_markup', function( $html, $id, $required, $options, $value_type ) {
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
@bappi-d-great
bappi-d-great / code.php
Created October 24, 2018 13:23
WPMU DEV Forminator phone number validation
<?php
// Assuming one phone field in a form
add_filter( 'forminator_custom_form_submit_errors', 'check_form_data', 99, 3 );
function check_form_data( $submit_errors, $form_id, $field_data_array ) {
$valid = false;
foreach( $field_data_array as $val ) {
if( $val['name'] == 'phone-1' ) {
$phone = $val['value'];
@wpmudev-sls
wpmudev-sls / wpmudev-forminator-listing-author.php
Last active November 21, 2022 15:41
[Forminator Pro] - Send email to listing's author. Extend existing functionality of Easy Property Listing to send email to listing's author
<?php
/**
* Plugin Name: [Forminator Pro] - Send email to listing's author
* Plugin URI: https://premium.wpmudev.org/
* Description: Extend existing functionality of Easy Property Listing to send email to listing's author (as of 1.9)
* Author: Alessandro Kaounas @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* License: GPLv2 or later
*/