Skip to content

Instantly share code, notes, and snippets.

Suraj N. Kurapati sunaku

Block or report user

Report or block sunaku

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

Keybase proof

I hereby claim:

  • I am sunaku on github.
  • I am sunaku ( on keybase.
  • I have a public key ASBP3INxz9p7lkGtL5u-P-wMRaZ4oyRVNY3u3NHrizZVXwo

To claim this, I am signing this object:

sunaku / gist:6a043d726b46a9bfaeb3
Created Oct 21, 2015
Elixir's Logger to stderr
View gist:6a043d726b46a9bfaeb3
$ mix new foo
* creating
* creating .gitignore
* creating mix.exs
* creating config
* creating config/config.exs
* creating lib
* creating lib/foo.ex
* creating test
* creating test/test_helper.exs
sunaku / interleave.exs
Created Sep 15, 2015
Persistent zipping (interleaving) in Elixir.
View interleave.exs
defmodule Interleave do
def interleave(a, b, result \\ [])
def interleave([], [], result), do: result |> Enum.reverse
def interleave([], b, result), do: interleave(b, [], result)
def interleave([h|t], b, result), do: interleave(b, t, [h | result])
iex(1)> split = Regex.split(~r/x/, "fooxbar")
["foo", "bar"]
iex(2)> scan = Regex.scan(~r/x/, "fooxbar")
View issue-315.sozi.html
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at -->
<!doctype html>
<meta charset="utf-8">
sunaku / fizzbuzz.exs
Last active May 14, 2017
A functional FizzBuzz (without any integer modulus or division) in Elixir. See
View fizzbuzz.exs
# A functional FizzBuzz (without any integer modulus or division) in Elixir
nums = Stream.iterate(1, &(&1 + 1))
fizz = Stream.cycle ["", "", "Fizz"]
buzz = Stream.cycle ["", "", "", "", "Buzz"]
fizzbuzz =, buzz) |> |>
{{"", "" }, number} -> number
{{fizzword, buzzword}, _number} -> fizzword <> buzzword
fizzbuzz |> Stream.take(100) |> Enum.each(&IO.puts/1)
sunaku / shed
Last active Sep 7, 2016
POSIX shell script equivalent of
View shed
#!/bin/sh -e
# POSIX shell script equivalent of:
# <>
# Usage: shed [SHELL_ARGUMENTS...]
# Executes stdin after you edit it.
# If $EDITOR is unset, uses $PAGER.
# If $PAGER is unset, uses cat(1).
sunaku / stay.log
Last active Aug 29, 2015
vim-fetch issue #7
View stay.log
calling function fetch#visual(1)
line 1: " get text between last visual selection marks
line 2: " adapted from
line 3: let [l:startline, l:startcol] = getpos("'<")[1:2]
line 4: let [l:endline, l:endcol] = getpos("'>")[1:2]
line 5: let l:endcol = min([l:endcol, col([l:endline, '$'])]) " 'V' col nr. bug
line 6: let l:endcol -= &selection is 'inclusive' ? 0 : 1
line 7: let l:lines = getline(l:startline, l:endline)
line 8: if visualmode() isnot? 'v' " block-wise selection
sunaku / sjsu-course-prereqs.rb
Last active Aug 29, 2015
Dumps course prerequisites for the given SJSU (San Jose State University degree program as a DOT (Graphviz graph. You can play with the resulting graph by pasting it into the Vis.js playground ( or you can convert it into a PDF with cl…
View sjsu-course-prereqs.rb
#!/usr/bin/env ruby
# Usage: ruby sjsu-course-prereqs.rb [PROGRAM_INFO_URL]
# Dumps course prerequisites for the given SJSU degree program as a DOT graph.
# If no PROGRAM_INFO_URL is given, the M.S. Computer Science program is used:
# You can convert the graph into a PDF with clickable course links like this:
ARGS=$( echo "$*" | sed 's/ -url / -host /; s/ -langselen\>//' )
$HOME/.cisco/hostscan/bin/cstub -log error $ARGS
sunaku / chromeos-vpn
Created Apr 9, 2014
View chromeos-vpn
# Connects to the VPN specified by the given vpnc(1) configuration file and
# then waits for you to interrupt or kill this process, at which time it
# disconnects the VPN. See
# Setup: apt-get install vpnc wireless-tools
You can’t perform that action at this time.