Skip to content

Instantly share code, notes, and snippets.

View avoidwork's full-sized avatar

Jason Mulligan avoidwork

View GitHub Profile
@avoidwork
avoidwork / gist:0c5170900146c936b29b5e0de4c87921
Created March 29, 2024 13:53
Debian 12 nvidia drivers (apt/sources.list)
# add options to primary
non-free contrib
# add source
deb https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware
@avoidwork
avoidwork / .txt
Last active December 19, 2023 11:44
debian nvidia
$ vi /etc/apt/sources.list
# add [contrib], [non-free] to [main] line
deb http://deb.debian.org/debian/ bookworm main non-free-firmware contrib non-free
$ LINUX_HEADERS=$(uname -r)
$ apt update
$ apt -y install nvidia-driver firmware-misc-nonfree linux-headers-$LINUX_HEADERS dkms
# default [nouveau] driver is disabled
$ cat /etc/modprobe.d/nvidia-blacklists-nouveau.conf
# You need to run "update-initramfs -u" after editing this file.
@avoidwork
avoidwork / gist:79bc09046b403d2ab1ee9e8e853ee8ad
Last active April 10, 2023 00:27
intel gpu transcoding in plex and ubuntu with celeron n5105
sudo tee /etc/modprobe.d/i915.conf <<EOF
options i915 enable_guc=2
EOF
sudo update-initramfs -u
sudo apt install intel-gpu-tools
sudo apt install ocl-icd-libopencl1 intel-opencl-icd
(reboot)
@avoidwork
avoidwork / gist:001d8a8188eed63e906262dcb7275b29
Created February 26, 2023 17:32
Docker volume with bind to folder
$ docker volume create --driver local \
--opt type=none \
--opt device=/home/user/test \
--opt o=bind \
test_vol
@avoidwork
avoidwork / gist:3749973
Created September 19, 2012 14:29
MySQL sp_split() splits a comma delimited string into a recordset & inserts it into target table or returns it
-- ----------------------------
-- Procedure structure for `sp_split`
-- ----------------------------
DROP PROCEDURE IF EXISTS `sp_split`;
delimiter ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_split`(IN toSplit text, IN target char(255))
BEGIN
# Temp table variables
SET @tableName = 'tmpSplit';
SET @fieldName = 'variable';
function hyphenize (arg = '') {
return arg.match(/([a-z]{1,2})/ig).join('-');
}
@avoidwork
avoidwork / gist:4698968
Last active September 12, 2021 20:14
filesize.js examples
filesize(500); // "500 B"
filesize(500, {bits: true}); // "4 kbit"
filesize(265318, {base: 2}); // "259.1 KiB"
filesize(265318); // "265.32 kB"
filesize(265318, {round: 0}); // "265 kB"
filesize(265318, {output: "array"}); // [265.32, "kB"]
filesize(265318, {output: "object"}); // {value: 265.32, symbol: "kB", exponent: 1, unit: "kB"}
filesize(1, {symbols: {B: "Б"}}); // "1 Б"
filesize(1024); // "1.02 kB"
filesize(1024, {exponent: 0}); // "1024 B"
@avoidwork
avoidwork / index.js
Last active August 31, 2021 19:12
Azure Function node.js with pagination, sorting & hypermedia
'use strict';
const url = require('url'),
config = require('./config.json'),
mongodb = require('mongodb'),
keysort = require('keysort');
function clone (arg) {
return JSON.parse(JSON.stringify(arg));
}
@avoidwork
avoidwork / adobe.js
Created April 7, 2019 20:40
Adobe employees active on github
(async function () {
const fetch = require('node-fetch'),
moment = require('moment'),
users = new Map(),
size = 100;
let i = -1,
nth = -1,
done = false;
@avoidwork
avoidwork / gist:7ea182c5fbfb014b891ad205cd580502
Created November 15, 2018 19:18
MongoDB flatten aggregation & update
new_recommended = db.profiles.aggregate([{$unwind: "$recommended"}, {$group: {_id : "$_id", recommended: {$push: "$recommended"}}}]).toArray();
new_recommended.forEach(function (x) {db.profiles.update({_id: x._id}, {$set: {recommended: x.recommended}})});