Skip to content

Instantly share code, notes, and snippets.

View h3ct0r's full-sized avatar
☢️
Quarantine

Héctor Azpúrua h3ct0r

☢️
Quarantine
View GitHub Profile
@h3ct0r
h3ct0r / query_gpu_usage_ssh.bash
Created July 2, 2021 17:26
Query GPU usage (with nvdia-smi) on a list of servers via SSH. It ask for password for all machines and store it on a variable which is cleared after the script is finished (no password is kept in the bash logs).
read -p "User please: " -s USER && read -p "Password please: " -s PASS && echo -e "\nBeginning SSH query with user: $USER\n" && for host in '150.164.212.21' '150.164.212.23' '150.164.212.24' '150.164.212.25' '150.164.212.26' '150.164.212.27' '150.164.212.28' '150.164.212.33' '150.164.212.36' '150.164.212.37' '150.164.212.40' '150.164.212.42' '150.164.212.43' '150.164.212.45' '150.164.212.71' '150.164.212.72' '150.164.212.73' '150.164.212.75' '150.164.212.76' '150.164.212.80' '150.164.212.81' '150.164.212.117' '150.164.212.141' '150.164.212.148' '150.164.212.164' '150.164.212.171' '150.164.212.204' '150.164.212.226'; do sshpass -p $PASS ssh -oStrictHostKeyChecking=no $USER@$host 'echo "host:$(hostname) GPU usage: $(nvidia-smi --query-gpu=utilization.gpu,memory.free,memory.total --format=csv,noheader)"' 2> /dev/null; done && PASS="" && USER=""
@RodolfoFerro
RodolfoFerro / click_connect_button.js
Last active November 27, 2023 06:28
Stop Colab from disconnecting, 2021.
function ClickConnect() {
console.log('Working')
document
.querySelector('#top-toolbar > colab-connect-button')
.shadowRoot.querySelector('#connect')
.click()
}
intervalTiming = setInterval(ClickConnect, 60000)
@stevecondylios
stevecondylios / resize-image-in-github-issue-github-flavored-markdown.md
Last active April 15, 2024 10:43
How to Resize an Image in a Github Issue (e.g. Github flavored Markdown)

How to Resize an Image in Github README.md (i.e. Github Flavored Markdown)

Percentage:

<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width=50% height=50%>

Pixels:

<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width="150" height="280">

@Amir22010
Amir22010 / convert_voc_to_yolo.md
Created February 22, 2020 22:01 — forked from myounus96/convert_voc_to_yolo.md
convert pascal voc dataset to yolo format

Convert PascalVOC Annotations to YOLO

This script reads PascalVOC xml files, and converts them to YOLO txt files.

Note: This script was written and tested on Ubuntu. YMMV on other OS's.

Disclaimer: This code is a modified version of Joseph Redmon's voc_label.py

Instructions:

  1. Place the convert_voc_to_yolo.py file into your data folder.
@geoffyuen
geoffyuen / firestick4k.md
Last active November 7, 2023 15:59
Amazon Fire Stick 4k Tips and Tricks
@matheustguimaraes
matheustguimaraes / install-cuda-cudnn.md
Last active March 20, 2023 05:08
Install CUDA 10.0 and cuDNN v7.4.2 on Ubuntu 16.04

Install CUDA 10.0 and cuDNN v7.4.2 on Ubuntu 16.04

Install the latest NVIDIA driver

Update package lists, download and install NVIDIA driver

sudo apt-get update
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt install nvidia-410
@KenjiOhtsuka
KenjiOhtsuka / sample.kt
Created October 30, 2018 18:40
Kotlin prepared statement (SQL)
package com.improve_future.sample
import java.io.Closeable
import java.sql.DriverManager
import java.sql.Statement
import java.text.SimpleDateFormat
class Connection(private val coreConnection: java.sql.Connection) :
java.sql.Connection by coreConnection, Closeable {
@jsheedy
jsheedy / skeletonize.py
Created June 10, 2016 23:56
OpenCV-Python skeletonize function
def skeletonize(img):
""" OpenCV function to return a skeletonized version of img, a Mat object"""
# hat tip to http://felix.abecassis.me/2011/09/opencv-morphological-skeleton/
img = img.copy() # don't clobber original
skel = img.copy()
skel[:,:] = 0
kernel = cv2.getStructuringElement(cv2.MORPH_CROSS, (3,3))
@rdeavila
rdeavila / git-update-fork.sh
Last active February 19, 2024 16:02
Git: como atualizar um fork com as mudanças do original?
#!/bin/bash
# Adicione um novo remote; pode chamá-lo de "upstream":
git remote add upstream https://github.com/usuario/projeto.git
# Obtenha todos os branches deste novo remote,
# como o upstream/master por exemplo:
git fetch upstream
@jbonney
jbonney / spotify_keybindings
Created June 9, 2013 13:22
Spotify - Linux key bindings. From XFCE / Ubuntu keyboard shortcuts configuration, assign the control command to their key. http://shkspr.mobi/blog/2011/12/linux-spotify-keybindings/
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrevious