Skip to content

Instantly share code, notes, and snippets.

View novemberkilo's full-sized avatar

Navin Keswani novemberkilo

View GitHub Profile
@novemberkilo
novemberkilo / tricks-nk.txt
Last active December 1, 2020 01:37
cli hints and tricks
## Sum the numbers in a column with header 'value'
cat data.csv | xsv select value | tail -n+2 | awk '{ SUM += $1} END { print SUM }'
## xargs with multiple ops -- here drop a column from all csv in this dir and store results
## in another directory
ls | xargs -L 1 -I 'file' sh -c "xsv select '\!original_area_code' 'file' > no_original_area_code/'file'"
@novemberkilo
novemberkilo / StackedBars for TER
Last active August 29, 2015 14:09
A Pen by Navin.
Stacked Bars in c3.js to spike TER representation
------
Forked from [Akhil](http://codepen.io/akhilgkrish/)'s Pen [leaKq](http://codepen.io/akhilgkrish/pen/leaKq/).
A [Pen](http://codepen.io/novemberkilo/pen/dPywWg) by [Navin](http://codepen.io/novemberkilo) on [CodePen](http://codepen.io/).
[License](http://codepen.io/novemberkilo/pen/dPywWg/license).

Keybase proof

I hereby claim:

  • I am novemberkilo on github.
  • I am novemberkilo (https://keybase.io/novemberkilo) on keybase.
  • I have a public key whose fingerprint is B6C7 727D 0019 4955 25BF 3496 EC8F 5030 0828 2CA0

To claim this, I am signing this object:

set -g default-terminal "screen-256color"
set -g status-left-length 52
set -g status-right-length 451
set -g status-fg white
set -g status-bg colour234
set -g window-status-activity-attr bold
set -g pane-border-fg colour245
set -g pane-active-border-fg colour39
set -g message-fg colour16
@novemberkilo
novemberkilo / form.js
Created January 12, 2011 10:48
The jQuery that responds to clicking on the "Add another" link
$(document).ready(function() {
$("#add_user").click(function(e) {
$("#user_details_base").clone().appendTo($(".user_details")).show();
return false;
});
});
@novemberkilo
novemberkilo / _form.html.haml
Created January 12, 2011 10:41
The partial making up the form
#user_details_base.hide= render "invitee_form"
- form_tag invite_other_users_path(@user),
:method => :put, :id => "form1", :class => "user_invite" do
.user_details
= render "invitee_form"
.add_user_button
= link_to "Add another", "#", :id => "add_user"
%span
@novemberkilo
novemberkilo / _invitee_form.html.haml
Created January 12, 2011 10:16
Basic form with three input fields in one row
- fields_for "recommendation[]" do |f|
.inviter
.field
= f.label :first_name, 'First Name:'
= f.text_field :first_name, :value => ""
.field
= f.label :last_name, 'Last Name:'
= f.text_field :last_name, :value => ""
.field
= f.label :recipient_email, 'Email:'
require 'rubygems'
require 'mail'
mail = Mail.new do
to 'navin@keswani.org'
from 'navin.keswani@gmail.com'
subject 'Plain text email - constructed in Ruby'
end
@novemberkilo
novemberkilo / flickraw_usage_snippet.rb
Created May 8, 2010 01:05
Snippet to demonstrate the usage of flickraw to get recent activity on a photostream. Assumes that the user is authenticated.
recent_activity = flickr.activity.userPhotos(:timeframe => timeframe)
recent_activity.each do |x|
message = ''
x.activity.event.each do |z|
case
when z.type == "comment" then
begin
unless @displayed_comments.include? z.commentid
@displayed_comments.push z.commentid