This file contains 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 torch | |
import torch.nn as nn | |
import math | |
from torch import Tensor | |
from torch.nn import functional as F | |
from dataclasses import dataclass | |
from typing import Optional, Literal | |
def count_parameters(model: nn.Module) -> int: |
This file contains 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
#!/usr/bin/env bash | |
# --------------------------------------------- | |
# This has been updated to work with Fedora 35 | |
# --------------------------------------------- | |
# Run a System Update | |
sudo dnf update | |
# Enable RPM Fusion |
This file contains 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
/* | |
Author: Arjun Variar | |
Date: 23rd Oct 2012 | |
kMeans Clustering algorithm implemented from javascript as per the logic from Andrew Ng's ML class. | |
Implementation is for node.js, should work on the browser too. | |
Dependencies: | |
Javascript Sylvester library is used for matrix operations. | |
Notes: | |
Added feature scaling to the algorithm as an optional thing to do, somehow it doesnt fit well this data. | |
*/ |
This file contains 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
var text = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatt |
This file contains 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
function FIB(n) { | |
phi = (1 + Math.sqrt(5))/2 | |
eta = (1-phi) | |
return (Math.pow(phi,n) - Math.pow(eta,n)) / Math.sqrt(5) | |
} | |
var j = 0 | |
for (var i = 5;i < 500;i++) { |
This file contains 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
var arr = [3, 4, 9, 14, 15, 19, 28, 37, 47, 50, 54, 56, 59, 61, 70, 73, 78, 81, 92, 95, 97, 99] | |
//var arr = [1,2,3,4,6] | |
function powerset(ary) { | |
var ps = [[]]; | |
for (var i=0; i < ary.length; i++) { | |
for (var j = 0, len = ps.length; j < len; j++) { | |
ps.push(ps[j].concat(ary[i])); | |
} | |
} | |
return ps; |
This file contains 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
# Author - Arjun Variar | |
# Thanks to Ben for introducing me to fiftyfootshadows, Awesome Wallpapers!! | |
#!/bin/sh | |
if [[ -z "$TMP" ]] | |
then | |
TMP="/private/tmp" | |
fi | |
dir="$HOME/fifty_downloads" |
This file contains 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
/* This Function determines the direction of your displacement based upon the width and height of the widget / viewport width height you are scrolling them. | |
The theta is calculated based upon the width and height of the widget, and sets the direction based upon the 4 quadrants which are formed due to the intersection of lines drawn from the vertices and the point on origin on the center of the widget. | |
This Leads to a cleaner user experience for scrolling, as this works smoothly for small or large widgets. | |
@Arjun Variar | |
*/ | |
function returnDirectionOfScroll(deltaX,deltaY,width,height) { | |
var angle = Math.atan2(-deltaY,-deltaX).toDeg(); |