Skip to content

Instantly share code, notes, and snippets.

View rantav's full-sized avatar
🎯
Focusing

Ran Tavory rantav

🎯
Focusing
View GitHub Profile
export GITHUB_USER=johndoe
$ export GITHUB_PASSWORD=mysecretgithubpassword
{
yotam: 'http://goo.gl/xt6Ch'
}
@rantav
rantav / youtube.py
Last active December 16, 2015 14:49
import gdata.youtube
import gdata.youtube.service
import re
yt_service = gdata.youtube.service.YouTubeService()
def PrintEntryDetails(entry):
print 'Video ID: %s' % extract_id_from_video_url(entry.media.player.url)
print 'Video title: %s' % entry.media.title.text
print 'Video published on: %s ' % entry.published.text
@rantav
rantav / my-podcasts.md
Last active December 13, 2015 22:49
The list of podcasts I listen to
@rantav
rantav / meetup-bad-bad-hosts.md
Last active November 2, 2017 15:27
How meetup fucked up, but then fixed it

Update: Meetup had revived the group and are welcoming us back again. At the end, no data was lost, even though interim communications suggested it was.
We are happy that things had finally taken a positive turn and are happy to stay at meetup and grow our community to our next event and next next event. We are a little bit sorry that things went soar for awhile but what's important is that at the end both us and meetup had learned how to make things better for the next time.

Original post below....

Meetup, you've been bad, bad hosts!

TL;DR: Meetup had deleted my group, for what I beleive to be their mistake, yet they did not admit the mistake nor can they restore the data. I am deeply dissapointed from meetup and I've lost my trust in them.

def kill_by_name(name):
"Kills a process by name (or any unique string). The name is a string from the command line (so be caraful of multiple occurrences)"
cmd = "ps aux | grep '%s' | grep java | grep -v grep | awk '{print $2}' | xargs kill" % name
with settings(hide('stdout'), warn_only=True):
sudo(cmd)
import sys
import traceback
try:
5 / 0
except ZeroDivisionError, e:
print e
# this will just print "integer division or modulo by zero"
# but if you try this:
exception_type, exception_value, exception_traceback = sys.exc_info()
# Start an HTTP server from a directory, optionally specifying the port
# Example:
# $ server
# Or:
# $ server 8002
function server() {
local port="${1:-8000}"
(sleep 0.5; open "http://localhost:${port}")&
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
@rantav
rantav / call_for_papers_reversim_summit.rb
Created December 6, 2012 23:47
Call for Papers, Reversim Summit 2013
require 'speaker'
require 'israel'
module Israel
module Summit
def call_for_papers(speaker, subject)
apply(spekaer) if ["DevOps, NoOps, Continuous Deployment, Dev Culture",
"Software Craftsmanship",
"Mobile dev",
"Web dev",
@rantav
rantav / gist:3945810
Created October 24, 2012 12:28
Chef processes
$ ps aux | grep chef
ubuntu 6122 0.0 0.0 7800 636 pts/3 S+ 12:24 0:00 grep --color=auto chef
root 8819 0.1 2.7 137336 47132 ? Sl Oct18 10:54 /opt/chef/embedded/bin/ruby /usr/bin/chef-client -d -P /var/run/chef/client.pid -L /var/log/chef/client.log -c /etc/chef/client.rb -i 1800 -s 20
chef 16025 0.2 7.4 649552 127244 ? Sl Sep19 101:34 java -Xmx256M -Xms256M -Dsolr.data.dir=/var/lib/chef/solr/data -Dsolr.solr.home=/var/lib/chef/solr/home -jar /var/lib/chef/solr/jetty/start.jar
chef 16084 0.5 4.3 186180 74012 ? Sl Sep19 282:09 merb : chef-server (api) : worker (port 4000)
chef 16152 0.5 3.2 141916 54408 ? Sl Sep19 259:50 merb : chef-server-webui : worker (port 4040)
$ ps aux | grep couch
ubuntu 6124 0.0 0.0 7800 640 pts/3 S+ 12:25 0:00 grep --color=auto couch
couchdb 7466 0.0 0.0 4220