Skip to content

Instantly share code, notes, and snippets.

View anjannath's full-sized avatar
🏴‍☠️

Anjan Nath anjannath

🏴‍☠️
  • Red Hat
  • Earth
View GitHub Profile
.Getting to WaitForSSH function...
(minishift) Calling .GetSSHHostname
(minishift) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM minishift ).networkadapters[0]).ipaddresses[0]
(minishift) DBG | [stdout =====>] : 172.17.160.249
(minishift) DBG |
(minishift) Calling .GetSSHPort
@anjannath
anjannath / change_locale_win.txt
Created February 22, 2018 09:31
Steps to change the locale in windows using powershell
Steps to change the system language:
--------------------------------------------------
$Language can be "jp-JP", "as-IN", etc.. Need to install the language pack before you can use it,
to install language pack use commands:
```powershell
$LP = Get-MUIPackagePath $Language $(Get-OSCurrentVersion).Version
Add-WindowsPackage -Online -PackagePath $LP.Path
Restart-Computer -Force -Confirm
```
@anjannath
anjannath / tz.sh
Created April 6, 2018 08:18 — forked from chmouel/tz.sh
#!/usr/bin/env bash
# needs bash v4
# you can do things like this :
# % tz
# % tz 10h30
# % tz 10h30 next week
# % tz 11:00 next thursday
#
# and so on!

Setting up Vim as your Go IDE

The final IDE

Intro

I've been wanting to do a serious project in Go. One thing holding me back has been a my working environment. As a huge PyCharm user, I was hoping the Go IDE plugin for IntelliJ IDEA would fit my needs. However, it never felt quite right. After a previous experiment a few years ago using Vim, I knew how powerful it could be if I put in the time to make it so. Luckily there are plugins for almost anything you need to do with Go or what you would expect form and IDE. While this is no where near comprehensive, it will get you writing code, building and testing with the power you would expect from Vim.

Getting Started

I'm assuming you're coming with a clean slate. For me this was OSX so I used MacVim. There is nothing in my config files that assumes this is the case.

Keybase proof

I hereby claim:

  • I am anjannath on github.
  • I am anjannath (https://keybase.io/anjannath) on keybase.
  • I have a public key ASDY9truHVgMDkiQWnDYT-SF4WuE7whF-oyGI24drYAWdwo

To claim this, I am signing this object:

In disconnected state macOS doesnot make dns requests.. so we need to make a tap device assign it an ip so that it thinks it is still connected to something,
after that the resolver file inside /etc/resolver/nip.io will be used for the resolving so we only need to ccreate a tap device and that's it.
1. Install the `tuntap` package from brew
2. Create a network service using the tap device.. need to edit the file in /Library/Preferences/SystemConfiguration/preferences.plist
add the following snippet to that file, under _NetworkServices_ key need to generate a uuid (`uuidgen`)
```
<key>D16F22CE-6DDE-4E63-837C-E16538EA5CCB</key> <-- uuid
<dict>
<key>DNS</key>
@anjannath
anjannath / GoConcurrency.md
Created July 26, 2018 11:03 — forked from rushilgupta/GoConcurrency.md
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@anjannath
anjannath / tmux-cheatsheet.markdown
Created November 22, 2018 06:41 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#!/usr/bin/env bash
vol_list=$(sudo virsh vol-list --pool default | grep test1 | awk '{print $1}')
for vol in $vol_list
do
sudo virsh vol-delete $vol --pool default
done
sudo virsh net-destroy test1
sudo virsh net-undefine test1
@anjannath
anjannath / irc.md
Created February 22, 2019 08:02 — forked from xero/irc.md
irc cheat sheet

#IRC Reference

Not intended as a guide for newbies, more like a "cheat sheet" for the somewhat experienced IRC user, especially one who wields some power over a channel.

##The Basics

  • /join #channel
    • Joins the specified channel.
  • /part #channel
    • Leaves the specified channel.