Skip to content

Instantly share code, notes, and snippets.

View kiranshila's full-sized avatar
🌈

Kiran Shila kiranshila

🌈
View GitHub Profile
@primus852
primus852 / cuda_11.7_installation_on_Ubuntu_22.04
Last active February 10, 2025 12:11 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.7 and cuDNN 8.5 installation on Ubuntu 22.04 for PyTorch 1.12.1
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@IGJoshua
IGJoshua / reload.clj
Last active January 28, 2022 21:00
Reloadable function vars
(require '[clojure.spec.alpha :as s])
(s/def ::defreloadable-args
(s/cat :name simple-symbol?
:doc (s/? string?)
:attr-map (s/? map?)
:fn-tails (s/+ any?)))
(defmacro defreloadable
"Defines a new function as [[defn]], but old references will refer to new versions when reloaded.
@moebiussurfing
moebiussurfing / ImGuiDockspaceExample.cpp
Created July 29, 2021 05:43 — forked from AidanSun05/ImGuiDockspaceExample.cpp
A modified DockSpace example for Dear ImGui. Changes are listed at the top of the file.
// CHANGES MADE:
// Added more clarifying comments inside the function.
// Removed MSVC warning C6011 - null pointer dereference.
// Fixed a slight grammar error - "This demo app only demonstrate" => "This demo app only demonstrates"
// Demonstrate using DockSpace() to create an explicit docking node within an existing window.
// Note: You can use most Docking facilities without calling any API. You DO NOT need to call DockSpace() to use Docking!
// - Drag from window title bar or their tab to dock/undock. Hold SHIFT to disable docking.
// - Drag from window menu button (upper-left button) to undock an entire node (all windows).
// About dockspaces:
@moebiussurfing
moebiussurfing / dock_builder_example.cpp
Created July 29, 2021 03:36 — forked from PossiblyAShrub/dock_builder_example.cpp
Simple example, of how to use the dock builder API. (Adapted from the dock space example in the demo window) You need to use the docking branch and set the ImGuiConfigFlags_DockingEnable config flag. Learn more about Dear ImGui here: https://github.com/ocornut/imgui
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_PassthruCentralNode;
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
// because it would be confusing to have two docking targets within each others.
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos);
ImGui::SetNextWindowSize(viewport->Size);
ImGui::SetNextWindowViewport(viewport->ID);
@rgkirch
rgkirch / 20210518185742-current_re_frame_app_state_as_a_fold_over_events.org
Created May 21, 2021 01:03
current re-frame app state as a fold over events

current re-frame app state as a fold over events

https://day8.github.io/re-frame/EffectfulHandlers/

at any one time, the value in app-db is the result of performing a reduce over the entire collection of events dispatched in the app up until that time. The combining function for this reduce is the set of registered event handlers.

@JohnnyJayJay
JohnnyJayJay / discljord-slash-commands.md
Last active January 10, 2025 19:08
Quick primer for slash commands in discljord

Working with Slash Commands in discljord

At the end of 2020, Discord introduced a new feature that is available to bots: Slash Commands.
Slash Commands belong to a new feature category called "Interactions" which finally allows bots to enhance the Discord UI. As such, the way slash commands (and upcoming interactions such as clickable buttons aka. "components") work is quite different from other parts of the API.

What exactly are Slash Commands?

Slash commands are Discord entities that you can create, edit and delete through requests. Registered commands have a name and a description and are accessible in Discord clients by typing /name.
There are two types of commands: guild and global. As the names indicate, commands of the former type are only accessible in one specific guild

@ixs
ixs / intel_x520_patcher.py
Last active May 10, 2025 05:25
Intel x520 EEPROM Patcher allows to unlock the x520 network card to work with non-intel branded SFP modules.
#!/usr/bin/env python3
#
# Simple Intel x520 EEPROM patcher
# Modifies the EEPROM to unlock the card for non-intel branded SFP modules.
#
# Copyright 2020,2021,2022 Andreas Thienemann <[email protected]>
#
# Licensed under the GPLv3
#
# Based on research described at https://forums.servethehome.com/index.php?threads/patching-intel-x520-eeprom-to-unlock-all-sfp-transceivers.24634/
@frasertweedale
frasertweedale / certbot-dns-ipa.py
Created May 13, 2020 03:37
certbot-dns-ipa.py
#!/usr/bin/python3
import os
from dns import resolver
from ipalib import api
from ipapython import dnsutil
certbot_domain = os.environ['CERTBOT_DOMAIN']
certbot_validation = os.environ['CERTBOT_VALIDATION']
if 'CERTBOT_AUTH_OUTPUT' in os.environ:

Rust Error Handling Cheatsheet - Result handling functions

Introduction to Rust error handling

Rust error handling is nice but obligatory. Which makes it sometimes plenty of code.

Functions return values of type Result that is "enumeration". In Rust enumeration means complex value that has alternatives and that alternative is shown with a tag.

Result is defined as Ok or Err. The definition is generic, and both alternatives have