Skip to content

Instantly share code, notes, and snippets.

View vinaydotblog's full-sized avatar
🏠
Working from home

Vinay Aggarwal vinaydotblog

🏠
Working from home
View GitHub Profile
@sts10
sts10 / rust-command-line-utilities.markdown
Last active April 24, 2024 18:49
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
@mpneuried
mpneuried / Makefile
Last active April 19, 2024 21:06
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@vinaydotblog
vinaydotblog / latlng_to_city.js
Last active November 18, 2017 16:34
Gives back City Name based on given latitude/longitude values.
/*
* Pass it your string of latlong and it'll return a promise to come back with the locality, city.
*
* getCity('12.9715987,77.5945627').done(function(cityName){
* $elem.val( cityName )
* });
*
* Info: jQuery is required for $.Deferred() and $.getJSON to work!
* Regardless of everything modify it as per your convenience :)
*/
@andyshinn
andyshinn / composer.json
Last active February 18, 2024 12:05
Docker Compose PHP Composer Example
{
"require": {
"mfacenet/hello-world": "v1.*"
}
}
@karpathy
karpathy / min-char-rnn.py
Last active April 23, 2024 17:55
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)
@samratmazumder91
samratmazumder91 / n2w.php
Last active August 29, 2015 14:17
Number to Word Conversion
<?php
function n2w($a){
$word = array();
$deno = array(1000=>'hundred',100000=>'thousand',10000000=>'lac',1000000000=>'crore');
$ones = array(1 => 'one',2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6=>'six',7=>'seven',8=>'eight',9=>'nine');
$tens = array(1 => 'ten',2 => 'twenty', 3 => 'thirty', 4 => 'forty', 5 => 'fifty', 6=>'sixty',7=>'seventy',8=>'eighty',9=>'ninety');
$exception = array(1 => 'eleven',2 => 'twelve', 3 => 'thirteen', 4 => 'fourteen', 5 => 'fiveteen', 6=>'sixteen',7=>'seventeen',8=>'eighteen',9=>'nineteen');
@vinaydotblog
vinaydotblog / number_format.coffee
Created October 24, 2013 07:18
Number Format : Formatting a given number into million format upto 2 decimals.
number_format = (num) ->
dot = (num = num + "").indexOf(".")
if dot is -1
dot = num.length
num = num + ".00"
last = num.substr(dot).substr(0,3)
first = num.substr(0, dot)
rem = first.length % 3
middle = first.substr(rem)
first = first.substr(0, rem)
@vinaydotblog
vinaydotblog / bookmarkScroll
Last active October 2, 2015 10:07
Smooth scroll with HTML bookmarks
// Menified Version of Smooth scrool Script given below:
(function(b){var c=window.location.hash;1<c.length&&(c=b(c),c.length&&b("html,body").animate({scrollTop:c.offset().top},400));b(document).on("click","a",function(c){var a=b(this).attr("href");if(a&&~a.indexOf("#")){var a=a.substr(a.indexOf("#")+1),d=b("a[name="+a+"]"),e=b("#"+a);console.log(a);d=d.length?d:e;d.length&&(c.preventDefault(),b("html,body").animate({scrollTop:d.offset().top},400))}})})(jQuery);
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@remy
remy / gist:330318
Created March 12, 2010 13:59
autofocus and placeholder support
/**
* Add this script to the end of your document that use <input autofocus type="text" />
* or <input type="text" placeholder="username" /> and it'll plug support for browser
* without these attributes
* Minified version at the bottom
*/
(function () {
function each(list, fn) {
var l = list.length;