Skip to content

Instantly share code, notes, and snippets.

😴
Dozing off

Rohith Reddy rohith

😴
Dozing off
Block or report user

Report or block rohith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rohith
rohith / amazecrawl.js
Created May 8, 2019
nodejs script to crawl amazon for deals on wishlist items via public wishlist url
View amazecrawl.js
const request = require("request"),
cheerio = require("cheerio"),
notifier = require("node-notifier")
const DOMAIN = "https://www.amazon.in",
WISHLISTURLS = [],
CURRENCYFORMATTER = new Intl.NumberFormat("en-IN", {
style: "currency",
currency: "INR",
minimumFractionDigits: 2,
@rohith
rohith / golang tour summary.md
Created May 8, 2019
Points picked up when looking at golang tour
View golang tour summary.md

Quickbytes

  • In Go, a name is exported if it begins with a capital letter
  • The expression T(v) converts the value v to the type T
  • Go has only one looping construct, the for loop (init; condition; post)
  • The if statement can start with a short statement to execute before the condition
  • A defer statement defers the execution of a function until the surrounding function returns
  • Deferred function calls are pushed onto a stack. When a function returns, its deferred calls are executed in last-in-first-out order
  • The & operator generates a pointer to its operand. The * operator denotes the pointer's underlying value
  • Pointers to structs can access members with p.X instead of (*p).X
View Default location for Docker VM HDD
C:\Users\Public\Documents\Hyper-V\Virtual hard disks\MobyLinuxVM.vhdx
@rohith
rohith / images.ps1
Last active Mar 25, 2019
Find images & return count & path within child directories recursively
View images.ps1
ls -Exclude node_modules -Recurse -Include *.jpg, *.jpeg, *.tiff, *.gif, *.webp, *.dng, *.mpg, *.mod, *.mmv, *.tod, *.wmv, *.asf, *.avi, *.divx, *.mov, *.m4v, *.3gp, *.3g2, *.mp4, *.m2t, *.m2ts, *.mts, *.mkv | group -Property Directory -NoElement | sort -Property Count -Descending | select Count, Name | ft > .\pics.txt
@rohith
rohith / functions.styl
Last active May 14, 2019
Stylus Functions
View functions.styl
random(a, b)
return math(math(0, 'random') * (b - a + 1) + a, 'floor')
media(screen-pixels)
if unit(screen-pixels, "") > 0
@media (min-width: screen-pixels)
{block}
else
@media (max-width: abs(screen-pixels))
{block}
@rohith
rohith / bitbucket-repo-Xfer.js
Created Feb 11, 2019
Transfer the ownership of multiple bitbucket repos using Puppeteer browser automation
View bitbucket-repo-Xfer.js
const puppeteer = require("puppeteer-core");
const currentOwnerUsername = "", currentOwnerPassword = "", transferToOwnerUsername = "",
loginUrl = "https://bitbucket.org/account/signin/", chromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
// list of repos to change ownership for
const repos = [
"https://bitbucket.org/{username}/{repo-name}"
];
@rohith
rohith / run.ps1
Last active Jul 4, 2019
Setup Docker to run samba to share persistant volume as a shared drive on windows
View run.ps1
# docker run -d -v "godisk:/godisk" --name godisk --net=host -e USERID=0 -e GROUPID=0 dperson/samba -s "godisk;/godisk;yes;no"
# cmd /c "mklink /D go \\10.0.75.2\godisk"
# docker run -it -v "godisk:/go/src" --name godev golang:alpine
# docker start -i godev
# docker run --rm -itd -v "godrive:/godrive" --name samba --net=host -e USERID=0 -e GROUPID=0 dperson/samba -s "godrive;/godrive;yes;no"
@rohith
rohith / Proxy.cs
Last active Jan 10, 2019
Generic Service Util Client Proxy to consume WCF services
View Proxy.cs
using System;
using System.ServiceModel;
public class Proxy<T>
{
public ChannelFactory<T> Factory { get; set; }
public Proxy()
{
Factory = new ChannelFactory<T>("endpoint");
@rohith
rohith / PS Profile SymLink.ps1
Created Dec 27, 2018
Create PowerShell profile SymLink from git repo
View PS Profile SymLink.ps1
@rohith
rohith / Pod Mem Usage.ps1
Last active Dec 6, 2018
Simplest way to debug why a pod got OOMKilled with exit code 137
View Pod Mem Usage.ps1
kubectl exec name-of-the-pod -- dmesg > C:\Path\To\Dump\File.txt
You can’t perform that action at this time.