Skip to content

Instantly share code, notes, and snippets.

@TengdaHan
TengdaHan / ddp_notes.md
Last active May 8, 2024 19:15
Multi-node-training on slurm with PyTorch

Multi-node-training on slurm with PyTorch

What's this?

  • A simple note for how to start multi-node-training on slurm scheduler with PyTorch.
  • Useful especially when scheduler is too busy that you cannot get multiple GPUs allocated, or you need more than 4 GPUs for a single job.
  • Requirement: Have to use PyTorch DistributedDataParallel(DDP) for this purpose.
  • Warning: might need to re-factor your own code.
  • Warning: might be secretly condemned by your colleagues because using too many GPUs.
@aaronhuang1005
aaronhuang1005 / Experiment1.r
Last active May 8, 2024 19:15
生醫訊號處理的實作 exp1 R script
# Created on Wed May 8 14:12:20 2024
# @author: Aaron Huang
#---------------------------------------------------------------------------------
# install signal library
install.packages("signal")
library("signal")
convolution <- function(x,h){
@tonY1883
tonY1883 / ValidateYoutubeVideoId.js
Created September 14, 2017 02:18
A small trick to check if youtube video exist with its id.
function validVideoId(id) {
var img = new Image();
img.src = "http://img.youtube.com/vi/" + id + "/mqdefault.jpg";
img.onload = function () {
checkThumbnail(this.width);
}
}
function checkThumbnail(width) {
//HACK a mq thumbnail has width of 320.
#!/bin/bash
VERSION="1.1.8"
info() {
echo -e "\033[32m[Info]\033[0m $1"
}
error() {
echo -e "\033[31m[Error]\033[0m $1"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davidteren
davidteren / nerd_fonts.md
Last active May 8, 2024 19:07
Install Nerd Fonts via Homebrew [updated & fixed]
Alpine.directive('typed', (el, { expression, modifiers }, { evaluateLater, effect, cleanup }) => {
const getStrings = evaluateLater(expression);
const modifierValue = (key, fallback) => {
if (-1 === modifiers.indexOf(key)) {
return fallback;
}
const value = modifiers[modifiers.indexOf(key) + 1];
@jsliang
jsliang / yearlyMoc.js
Last active May 8, 2024 19:05
Yearly MOC Generator - Obsidian Templater User Script
/**
* @author Jui-Shan (Jenny) Liang <jsliang.tw@gmail.com>
* @param {Object} tp the `tp` object of the Templater plugin
* @param {Object} options options for configuring the year to generate the MOC and the file name format
* @param {string} options.YEAR what year to generate the MOC; default to the current year
* @param {string} options.YEARLY_FORMAT filename format of yearly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.QUARTER_FORMAT filename format of quarterly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.MONTH_FORMAT filename format of monthly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.WEEK_FORMAT filename format of weekly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.DAY_FORMAT filename format of daily notes; format reference: https://momentjs.com/docs/#/displaying/format/
<php
class NameClass {
/**
* Genera numero secuencial de solicitud
*/
public function getNextOrderNumber()
{
// Get the last created order
$lastOrder = TuModelo::orderBy('created_at', 'desc')->first();
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 8, 2024 19:01
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory