Skip to content

Instantly share code, notes, and snippets.

View davidraedev's full-sized avatar
💭
Busy Being Awesome

D davidraedev

💭
Busy Being Awesome
View GitHub Profile
@davidraedev
davidraedev / downloader
Last active May 17, 2024 17:18
Download Debian Package and all dependencies (node)
// remote
const axios = require( "axios" );
const cheerio = require( "cheerio" );
const path = require( "path" );
const fs = require( "fs" );
const { exec } = require( "child_process" );
const crypto = require( "crypto" );
// vars
@davidraedev
davidraedev / gist:b0633115ca12803e82035f0fa54bf2c2
Created November 30, 2022 01:53
mysql show processlist sort by time
SELECT *
FROM INFORMATION_SCHEMA.PROCESSLIST
ORDER BY time DESC
@davidraedev
davidraedev / atq_list.sh
Created January 4, 2022 09:45
list all at jobs and their contents
#!/bin/bash
for j in $( atq | sort -k6,6 -k3,3M -k4,4 -k5,5 | cut -f 1 ); do atq | grep -P "^$j\t"; at -c "$j" | tail -n 2; done
@davidraedev
davidraedev / dedupe.js
Created December 8, 2021 09:51
Apple Image Capture Deduper
// Deduper for Apple Image Capture as it doesn't compare files and duplicates on import
// Is currently prone to crashing on certain (large?) files with malloc error
// drop in dir that images are imported into
const fs = require( "fs" );
const crypto = require( "crypto" );
let names = {};
function init() {
function rand( min, max ) {
min = Math.ceil( min );
max = Math.floor( max );
return Math.floor( Math.random() * ( max - min + 1 ) + min );
}
@davidraedev
davidraedev / gist:9d1f2a5f1601e22f416536ae84b0c7f5
Created April 1, 2021 11:03
Move process to screen session
ctrl+z
bg
disown %1
screen (or attach running screen)
reptyr (pid of process)
@davidraedev
davidraedev / gist:ee096eacd3e222adb50093b0aeb0bb13
Last active March 6, 2021 02:06
Bash date for filename / mysql
#filename
date +'%Y_%m_%d_%H_%M_%S'
# mysql
date +'%Y-%m-%d %H:%M:%S'
function reloadPage() {
history.replaceState( null, null, " " );
window.location = window.location.href.split( "#" )[0];
}
@davidraedev
davidraedev / gitpushpull.md
Created April 18, 2020 09:11 — forked from taldanzig/gitpushpull.md
Make push/pull work with a remote non-bare repository

Make push/pull work with a remote non-bare repository

Sometimes it is necessary (and desireable) to work on a git repository on multiple development machines. We want to be able to push and pull between repositories without having to use an intermediary bare repository, and for this to work symetrically in both repositories.

First clone we clone an existing repository:

git clone ssh://user@hostname:/path/to/repo

By default this will name the remote as origin, but let's assume we want to reserve that name for a master repository that commits will eventually get pushed to:

@davidraedev
davidraedev / new-of-plugin-dev.markdown
Created March 1, 2020 04:47 — forked from fabiomontefuscolo/new-of-plugin-dev.markdown
Starting plugin development in Openfire

New Openfire Plugin

Install requirements

$ sudo pacman -S \
	intellij-idea-community-edition \
	jre8-openjdk \
	maven