This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.font_manager as fm | |
| import matplotlib.pyplot as plt | |
| # Fetch DM Sans font file from https://github.com/google/fonts/blob/main/ofl/dmsans/DMSans%5Bopsz%2Cwght%5D.ttf | |
| font_dir = ['.'] | |
| for font in fm.findSystemFonts(font_dir): | |
| fm.fontManager.addfont(font) | |
| # Set font family globally | |
| plt.rcParams['font.family'] = 'DM Sans' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git clone --bare https://github.com/paidi/dotfiles.git $HOME/.cfg | |
| function config { | |
| /usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@ | |
| } | |
| mkdir -p .config-backup | |
| config checkout | |
| if [ $? = 0 ]; then | |
| echo "Checked out config."; | |
| else | |
| echo "Backing up pre-existing dot files."; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| m = nn.ParallelTable() | |
| layer = nn.SparseLinear(inputSize,outputSize) | |
| m:add(nn.Sequential():add(layer):add(nn.Reshape(1,outputSize))) | |
| for i=2,batchSize do | |
| local repLayer = layer:clone('weight', 'bias', 'gradWeight', 'gradBias') | |
| m:add(nn.Sequential():add(repLayer):add(nn.Reshape(1,outputSize))) | |
| end | |
| batchLayer = nn.Sequential():add(m):add(nn.JoinTable(1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local Adder = {} | |
| Adder.__index = Adder | |
| function Adder.new() | |
| local adder = {} | |
| setmetatable(adder, Adder) | |
| adder.total = 0 | |
| return adder | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local total = 0 | |
| for i=1,1000000 do | |
| total = total + i | |
| end | |
| print(total) |