Skip to content

Instantly share code, notes, and snippets.

View viig99's full-sized avatar
:electron:
Parsing

shadow_of_ged viig99

:electron:
Parsing
View GitHub Profile
@viig99
viig99 / fedora_setup.sh
Created September 27, 2022 13:26 — forked from engineervix/fedora_setup.sh
Things to do after installing Fedora
#!/usr/bin/env bash
# ---------------------------------------------
# This has been updated to work with Fedora 35
# ---------------------------------------------
# Run a System Update
sudo dnf update
# Enable RPM Fusion
@viig99
viig99 / kmeans.js
Created October 23, 2012 10:19
kMeans Clustering in Javascript
/*
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.
*/
@viig99
viig99 / gremlin_1.js
Created September 17, 2012 13:35
gremlin_1
var text = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatt
@viig99
viig99 / gremlin_2.js
Created September 17, 2012 13:34
gremlin_2
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++) {
@viig99
viig99 / gremlin_3.js
Created September 17, 2012 13:34
gremlin_3
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;
@viig99
viig99 / fiftyfootshadows.sh
Created July 11, 2012 12:52
Download Desktop Wallpapers from fiftyfootshadows.
# 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"
@viig99
viig99 / direction_scroll
Created July 2, 2012 12:49
Scrolling Direction.
/* 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();