Skip to content

Instantly share code, notes, and snippets.

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
const logActions = false;
class UpdateUserIds extends AbstractMigration
{
@umer936
umer936 / delete_dups.ps
Created August 28, 2023 23:42
Powershell empty/duplicate finder/remover
ls *.* -recurse | get-filehash | group -property hash | where { $_.count -gt 1 } | % { $_.group | select -skip 1 } | del
# https://n3wjack.net/2015/04/06/find-and-delete-duplicate-files-with-just-powershell/
@umer936
umer936 / fetch_wrapper.js
Last active May 22, 2023 16:30 — forked from Billcountry/LICENSE.md
A wrapper for fetch that takes jQuery ajax type setup
/**
* @umer936, umer936/ajaxFetchWrapper.js
* https://gist.github.com/umer936/c6bdbd80b8620dea5dfe7eac5e57b000
* modified from: Billcountry/fetch_wrapper.js
*
* @param options Object of options:
{
beforeSend (function): null,
url (string): "",
type (string): if data => "POST", otherwise "GET",
@umer936
umer936 / screen-rotation.sh
Created February 4, 2019 03:46
Grab accelerometer data from laptop
#! /bin/bash
/usr/bin/cat /sys/bus/iio/devices/iio\:device3/in_accel_x_raw
@umer936
umer936 / main.js
Last active July 13, 2020 15:42
Javascript bookmarklet to strip tracking tags in URLs for better bookmarking
javascript: void
function() {
var url = location.search;
if (url) {
var each = url.slice(1).split("&");
console.log("Stripping query parameters:", each);
var leave = each.filter(function(url) {
return "utm_" !== url.substr(0, 4) &&
"mc_" !== url.substr(0, 3) &&
"ct" !== url.substr(0, 2) &&
@umer936
umer936 / timesync.bat
Created February 11, 2018 07:15
Windows/Linux Synctime
@echo off && net start w32time && w32tm /resync /nowait && C:\Windows\System32\w32tm.exe /resync && net start w32time && w32tm /resync /nowait && C:\Windows\System32\w32tm.exe /resync
@umer936
umer936 / User-Package Control.sublime-settings
Last active October 12, 2017 04:54
Sublime Package Control Feb 10, 2016
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"All Autocomplete",
"AutoFileName",
"Better CoffeeScript",
@umer936
umer936 / temp.sh
Created July 20, 2017 23:38
Shows temperature of CPU in C and F
#!/bin/bash
while [ 1 ]
do
cpu_temp=$(< /sys/class/thermal/thermal_zone0/temp)
cpu_temp=$(($cpu_temp))
ceclis=$(echo "scale=1; $cpu_temp / 1000" | bc | tr '\n' ' ')
echo "$ceclis °C" | tr '\n' ' '
echo " | " | tr '\n' ' '
echo "scale=2; ( $cpu_temp / 1000 ) * 9 / 5 + 32" | bc | tr '\n' ' '
echo "˚F"
@umer936
umer936 / downloadJWcaptions.js
Created January 25, 2017 21:05
Prints out the captions from a JW video
innerDoc = document.getElementsByClassName("jwplayer");
var getVideo = innerDoc[0].getElementsByTagName('video')[0];
for (index = 0; index < getVideo.textTracks[0].cues.length; ++index) {
document.write(getVideo.textTracks[0].cues[index].text + " ");
}
@umer936
umer936 / ChangeJWrate.js
Last active February 16, 2017 20:02
Change playback rate on JWPlayer Flash videos. Credit to Hitesh on StackOverflow.
innerDoc = document.getElementsByClassName("jwplayer");
var getVideo = innerDoc[0].getElementsByTagName('video')[0];
var newspeed = prompt("Current Speed: " + getVideo.playbackRate + "\nNew Speed: ");
getVideo.playbackRate = newspeed;