Skip to content

Instantly share code, notes, and snippets.

View james-s-tayler's full-sized avatar

James Tayler james-s-tayler

View GitHub Profile
@james-s-tayler
james-s-tayler / __init__.py
Last active August 21, 2024 01:37
Flux Tonemap - no blurry background
import importlib
import os
node_list = [ #Add list of .py files containing nodes here
"sampler_tonemap"
]
NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}
@james-s-tayler
james-s-tayler / Dockerfile
Last active August 11, 2024 02:23
Dockerized Nvidia Cuda 11.8 Gradio App
# Since we're using the nvidia/cuda base image, this requires nvidia-container-toolkit installed on the host system to pass through the drivers to the container.
# see: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
# If you've just installed nvidia-container-toolkit, you may need to restart the docker daemon before it will detect the GPU
FROM nvidia/cuda:12.3.0-runtime-ubuntu22.04 AS final
WORKDIR /app
# Install Git and Git LFS
RUN apt-get update && apt-get install -y curl wget
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && apt-get install -y git-lfs
@james-s-tayler
james-s-tayler / 01_install-gnome2.sh
Last active April 12, 2022 03:48
dev environment Ubuntu 20.04 - .Net Core, Docker, Kubernetets, Node.js, VS Code, Terraform
#! /bin/bash
sudo apt-get install -y gnome-session-flashback
echo "you must restart - on login click the gear and choose gnome flashback (metacity)"
viewedFiles.forEach(viewedFile => {
const currentFile = document.querySelectorAll(`div[data-path="${viewedFile.path}"]`)[0] || undefined;
if(currentFile) {
let currentDiffstat = currentFile.querySelectorAll("span.diffstat")[0].getAttribute('aria-label');
let match = viewedFile.diffstats === currentDiffstat;
console.log(`match: ${match} - ${viewedFile.path} - viewedDiffstat: ${viewedFile.diffstats}, currentDiffstat: ${currentDiffstat}`);
if(match) {
let checkbox = currentFile.querySelectorAll('input[type="checkbox"]')[0];
let viewed = checkbox.checked || false;
select distinct(t.name), s.row_count from sys.tables t
join sys.dm_db_partition_stats s
on t.object_id = s.object_id
where t.is_ms_shipped = 0
order by row_count desc;
SELECT XEvent.query('(event/data/value/deadlock)[1]') AS DeadlockGraph
FROM (
SELECT XEvent.query('.') AS XEvent
FROM (
SELECT CAST(target_data AS XML) AS TargetData
FROM sys.dm_xe_session_targets st
INNER JOIN sys.dm_xe_sessions s ON s.address = st.event_session_address
WHERE s.NAME = 'system_health'
AND st.target_name = 'ring_buffer'
) AS Data
SELECT qs.last_logical_reads, st.text, qp.query_plan
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp
WHERE st.text LIKE '%extent1%' -- Quick and dirty check for a LINQ query
AND qp.dbid = DB_ID('AdventureWorks2012_big')
@james-s-tayler
james-s-tayler / sql-server-index-fragmentation.sql
Created October 27, 2019 11:34
SQL Server Index Fragmentation
select
ps.object_id,
idx.name,
idx.type_desc,
ps.alloc_unit_type_desc,
ps.avg_fragmentation_in_percent,
ps.fragment_count,
ps.avg_fragment_size_in_pages,
ps.page_count
from
function updateTimeLogged() {
var time = $("#log_hours").val() + "h " + $("#log_minutes").val() + "m";
$('#log-work-time-logged').val(time);
}
$(document).on("change", "#log_hours", function(event) {
updateTimeLogged();
});
$(document).on("change", "#log_minutes", function(event) {
$('.biz-listing-large').each(function(index, listItem) {
var shopName = $(listItem).find('.biz-name').text().trim();
var address = $(listItem).find('address').text().trim().replace(/Auckland/g,", Auckland");
console.log(shopName + "," + address);
});