Skip to content

Instantly share code, notes, and snippets.

View rantav's full-sized avatar
馃幆
Focusing

Ran Tavory rantav

馃幆
Focusing
View GitHub Profile
{
"Statement": [
{
"Sid": "AllowPublicRead",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Effect": "Allow",
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/chef-client/recipes/default.rb
================================================================================
Chef::Exceptions::ImmutableAttributeModification
------------------------------------------------
Node attributes are read-only when you do not specify which precedence level to set. To set an attribute use code like `node.default["key"] = "value"'
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鈥檛 break anything for binary files)