Skip to content

Instantly share code, notes, and snippets.

View sghael's full-sized avatar

Sandeep Ghael sghael

  • Brookline, MA
View GitHub Profile
@sghael
sghael / colors.xml
Created June 14, 2012 13:43
Android colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white">#FFFFFF</color>
<color name="ivory">#FFFFF0</color>
<color name="light_yellow">#FFFFE0</color>
<color name="yellow">#FFFF00</color>
<color name="snow">#FFFAFA</color>
<color name="floral_white">#FFFAF0</color>
<color name="lemon_chiffon">#FFFACD</color>
<color name="cornsilk">#FFF8DC</color>
@sghael
sghael / it.rb
Last active August 29, 2015 13:56 — forked from anonymous/it.rb
def it(n)
x = [*2..n]
x.each do |i|
[*(i+1)..n].each { |j| x.delete(j) if (j%i).zero? }
end
end
# 1) what does it do?
# 2) how fast is it?
# 3) can you make it faster?
@sghael
sghael / CUDA 11.8 on Ubuntu
Created November 25, 2023 18:00
CUDA on Ubuntu
#!/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
@sghael
sghael / cuda_reset.bash
Last active January 13, 2024 22:04
Code to solve `Triggered internally at ../c10/cuda/CUDAFunctions.cpp:108.) return torch._C._cuda_getDeviceCount() > 0` when un-suspending your Linux machine. I am using this on Ubuntu 22.04 with Nvidia Drivers 5.45 and Cuda 12.3
#!/bin/bash
# Function to find and kill gnome and xorg processes using the NVIDIA GPU
kill_gpu_processes() {
# Find Gnome and Xorg processes using the NVIDIA GPU
local gpu_processes=$(nvidia-smi | grep 'gnome\|xorg' | awk '{ print $5 }')
# Kill the processes gracefully
for pid in $gpu_processes; do
echo "Killing process with PID $pid"
kill $pid
@sghael
sghael / snake.py
Created April 18, 2024 20:35
LLaMa 3 8B instruction tuned, fp16
# prompt: "write a snake game for me in python"
import random
import pygame
pygame.init()
white = (255, 255, 255)
black = (0, 0, 0)
@sghael
sghael / gist:364f9ba4deab30272f8f221e27721d98
Created August 12, 2024 12:46
Adding Nerd Fonts to Chrome OS Terminal app
# put this in chrome-untrusted://terminal/html/nassh_preferences_editor.html
# all JB Nerd Fonts can be see here: https://www.jetbrains.com/lp/mono/#font-family
@font-face {
font-family: "JetBrains Mono Nerd Font Extra Light";
src: url("https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/JetBrainsMono/Ligatures/ExtraLight/JetBrainsMonoNerdFont-ExtraLight.ttf");
font-weight: normal;
font-style: normal;
}
@sghael
sghael / gist:6cba5c75a36ed271fa959c35e516e516
Last active November 11, 2024 10:47
Persistent WOL on Ubuntu 24.04
### Step-by-Step Guide
1. **Check for Active Connections:**
- Use `nmcli` to list active connections and identify the correct connection name:
```bash
nmcli connection show
```
2. **Edit the Connection Profile via nmcli:**