- Create an empty repo in BitBucket
git clone --bare [email protected]:user/repo.git
cd repo.git
git push --mirror [email protected]:user/repo.git
This file contains hidden or 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
#!/usr/bin/env python | |
# * Note: phantomjs must be in your PATH | |
# | |
# This script: | |
# - Navigates to www.google.com | |
# - Intentionally raises an exception by searching for a nonexistent element | |
# - Leaves behind a screenshot in exception.png | |
import unittest |
This file contains hidden or 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
upstream eaa_app_server { | |
server unix:/srv/www/eaa/run/gunicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name eaa.neurosnap.net; | |
client_max_body_size 4G; |
This file contains hidden or 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 ebaysdk | |
from ebaysdk import finding | |
api = finding(siteid='EBAY-GB', appid='<REPLACE WITH YOUR OWN APPID>') | |
api.execute('findItemsAdvanced', { | |
'keywords': 'laptop', | |
'categoryId' : ['177', '111422'], | |
'itemFilter': [ | |
{'name': 'Condition', 'value': 'Used'}, |
This file contains hidden or 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
#!/usr/bin/python | |
# coding: utf-8 | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def entry_point(): | |
return 'Hello World!' |
This file contains hidden or 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
-- Remove the history from | |
rm -rf .git | |
-- recreate the repos from the current content only | |
git init | |
git add . | |
git commit -m "Initial commit" | |
-- push to the github remote repos ensuring you overwrite history | |
git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git |
Ever had the need to create a branch in a repo on Github without wanting (or being able) to access a local repo?
With the aid of [the Github API][1] and any online request app this is a piece of cake!
Just follow these steps:
- Open an online request app (like apirequest.io, hurl.it pipedream.com, reqbin.com, or webhook.site)
- Find the revision you want to branch from. Either on Github itself or by doing a GET request from Hurl:
https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs/heads
- Copy the revision hash
- Do a POST request from Hurl to
https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs
with the following as the POST body :
This file contains hidden or 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
# Follow instructions here: http://flask.pocoo.org/snippets/65/ | |
# You'll need to make sure you have the right Python version and any packages installed: http://docs.webfaction.com/software/python.html | |
# This tweak to index.py is what made it actually work: http://stackoverflow.com/questions/3696606/how-to-solve-import-errors-while-trying-to-deploy-flask-using-wsgi-on-apache2 | |
import sys | |
yourappname = "/home/username/webapps/yourappname/htdocs" | |
if not yourappname in sys.path: | |
sys.path.insert(0, yourappname) | |
from yourappname import app as application |
This file contains hidden or 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
from PIL import Image | |
def average_image_color(filename): | |
i = Image.open(filename) | |
h = i.histogram() | |
# split into red, green, blue | |
r = h[0:256] | |
g = h[256:256*2] | |
b = h[256*2: 256*3] |
NewerOlder