Skip to content

Instantly share code, notes, and snippets.

View senthil88's full-sized avatar

Senthilkumar R A senthil88

View GitHub Profile
@senthil88
senthil88 / gstreamer_webcam_janus_webrtc.md
Created March 7, 2018 08:18 — forked from clungzta/gstreamer_webcam_janus_webrtc.md
(Ubuntu) Linux instructions for streaming webcam to janus gateway

Step 1 - Follow install and setup instructions for janus, gst-launch1.0, nginx (and required dependencies)

https://www.rs-online.com/designspark/building-a-raspberry-pi-2-webrtc-camera

Step 2 - Launch Janus

./janus -F /opt/janus/etc/janus/

Step 3 - Start streaming from webcam

gst-launch-1.0 v4l2src ! 'video/x-raw, width=640, height=480, framerate=30/1' ! videoconvert ! x264enc pass=qual quantizer=20 tune=zerolatency ! rtph264pay ! udpsink host=127.0.0.1 port=8004

Step 4 - Open demo page in browser

@senthil88
senthil88 / OUTPUT.md
Created August 11, 2016 11:17 — forked from rmm5t/OUTPUT.md
How to properly introduce a new counter_cache to an existing Rails project.

Fast/efficient approach:

-- execute("UPDATE posts SET comments_count = (SELECT count(1) FROM comments WHERE comments.post_id = posts.id)")
   -> 1.3197s

Slow/naïve approach:

@senthil88
senthil88 / point-in-polygon.rb
Created July 21, 2016 05:42 — forked from kidbrax/point-in-polygon.rb
Check whether a point is within a polygon
def point_in_polygon?(polygonPoints)
return false if self.latitude.blank? or self.longitude.blank?
polygonPoints.each do |point|
point[0] = point[0].to_f
point[1] = point[1].to_f
end
contains_point = false
i = -1
j = polygonPoints.size - 1
@senthil88
senthil88 / git-change-commit-messages.md
Created July 5, 2016 05:55 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published on fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.