This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import boto | |
from boto.s3.connection import S3Connection | |
from boto.s3.key import Key | |
file_name = sys.argv[1] | |
AWSAccessKeyId = '' | |
AWSSecretKey = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget --no-check-certificate -O - http://bootstrap.saltstack.org | sudo sh -s -- git v0.17.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for f in `ls -d *`; do | |
lxc-shutdown -n $f | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SESSION=$USER | |
tmux has-session -t $SESSION | |
if [ $? -eq 0 ]; then | |
echo "Session $SESSION already exists. Attaching." | |
sleep 1 | |
tmux attach -t $SESSION | |
exit 0; | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Task(models.Model): | |
name = models.CharField(max_length=200) | |
slug = models.SlugField() | |
body = models.TextField() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout master | |
git fetch ca master | |
git rebase ca/master | |
# create a new branch | |
git checkout -b my-new-branch | |
# push changes | |
git push origin my-new-branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url(r'^users/(?P<username>[-\w]+)/$', UserProfile.as_view(), name="userprofile"), | |
class UserProfile(generic.DetailView): | |
model = User | |
template_name = 'accounts/profile.html' | |
slug_field = 'username' # Should be field name for query in `get_object` queryset | |
slug_url_kwarg = 'username' # Should be actual data fro the URL username kwarg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Will work just fine because code executes when calling the view | |
# so there is something for reverse to create a url from | |
def view(request): | |
url = reverse('index') | |
return HttpResponse() | |
# Works well because when python parses this reverse_lazy just stores | |
# the name instead of trying to execute code so it works just fine | |
class ObjectCreateView(CreateView): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Signal(object): | |
def init(self): | |
self.receivers = [] | |
def output(self): | |
print self.receivers | |
def connect(self, receiver): | |
self.receivers.append(receiver) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainController < NSWindowController | |
def awakeFromNib | |
end | |
def newWindow(sender) | |
someData = "Blob" | |
nw = MainWindowController.alloc.init |
OlderNewer