Skip to content

Instantly share code, notes, and snippets.

View chaseking's full-sized avatar
⛰️

Chase King chaseking

⛰️
View GitHub Profile
@TengdaHan
TengdaHan / ddp_notes.md
Last active November 1, 2024 05:58
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.
@karpathy
karpathy / min-char-rnn.py
Last active November 20, 2024 02:50
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@staltz
staltz / introrx.md
Last active November 19, 2024 18:00
The introduction to Reactive Programming you've been missing
// https://github.com/Bukkit/CraftBukkit/blob/7e1ac0a77129b169704c1e222ff2deb3ab6cd2d2/src/main/java/net/minecraft/server/EntityPlayer.java#L596
//Method to open an anvil inventory to a player
public static void openAnvil(Player player, Inventory inventory){
//Get our EntityPlayer
EntityPlayer p = ((CraftPlayer) player).getHandle();
//Create the AnvilContainer
AnvilContainer container = new AnvilContainer(p);
@arxenix
arxenix / ImgMessage
Last active February 6, 2023 10:39
ImgMessage util class to send images to players with the chat bar!
package your-package;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.HashMap;
/**
@sahirshahryar
sahirshahryar / CompactRomanNumeral.java
Last active March 31, 2023 04:12
Roman numeral conversion
public static String romanNumerals (int value) {
String[] values = {
"M", "CM", "D", "CD", "C", "XC",
"L", "XL", "X", "IX", "V", "IV", "I"
};
int[] correspondents = {
1000, 900, 500, 400, 100, 90,
50, 40, 10, 9, 5, 4, 1
}
@JamesNorris
JamesNorris / Spiraling Effect
Last active December 29, 2015 09:39
The solution to chasechocolates' question on spiraling effects.
How do I make an effect that spirals, becoming smaller as time goes on?
So, as we know a circle is defined by the equation:
r^2 = (x - a)^2 + (y - b)^2
So that gets us the general equation with which we will be working. As a result, we should also know that:
as a->∞ = translation in the x, right
as b->∞ = translation in the y, up
@aadnk
aadnk / NbtFactory.java
Last active December 29, 2020 04:29
A compact library for editing or creating NBT tags, ready to be inserted into your project. It doesn't directly depend on CraftBukkit, but uses reflection to access it dynamically. Use this version for 1.7.2: http://tinyurl.com/attributestorage
package com.comphenix.example;
import java.io.BufferedInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@cnaude
cnaude / get.pl
Last active August 20, 2016 02:48
Parse output from http://forums.bukkit.org/members/?page=$i and sort by number of likes.
#!/usr/bin/perl
use strict;
for my $i (1..16420) {
system("wget -O data/bf.$i.html 'http://forums.bukkit.org/members/?page=$i'");
sleep 2;
}
@aadnk
aadnk / Attributes.java
Last active September 15, 2020 10:13
Edit attributes in 1.6.2 (Not dependent on ProtocolLib). See https://github.com/aadnk/AttributeStorage/tree/nms for 1.7.2.
package com.comphenix.example;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;