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
| #run bottle api using gunicorn | |
| from bottle import Bottle | |
| app = Bottle() | |
| @app.route("/") | |
| def index(): | |
| return "test index" |
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 flask import Flask | |
| from flask_sqlalchemy import SQLAlchemy | |
| import os | |
| import graphene | |
| from graphene_sqlalchemy import SQLAlchemyObjectType, SQLAlchemyConnectionField | |
| from flask_graphql import GraphQLView | |
| ################################# | |
| app = Flask(__name__) | |
| app.debug = True |
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
| def extract_values(obj, key): | |
| """Recursively pull values of specified key from nested JSON.""" | |
| arr = [] | |
| def extract(obj, arr, key): | |
| """Return all matching values in an object.""" | |
| if isinstance(obj, dict): | |
| for k, v in obj.items(): | |
| if isinstance(v, (dict, list)): | |
| extract(v, arr, key) |
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
| #!/bin/bash | |
| # This is for Ubuntu | |
| apt-get install xinetd | |
| ( | |
| cat << 'EOF' | |
| # default: on | |
| # description: mysqlchk | |
| service mysqlchk | |
| { |
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
| #!/bin/sh | |
| # | |
| # ******************************************* | |
| # WARNING: this does *not* handle 3-way merges properly. | |
| # Anything modified on the local branch since the common base will get ignored. | |
| # | |
| # FOR ANYONE LANDING HERE: | |
| # This script is now updated as part of the git-whistles gem. | |
| # https://github.com/mezis/git-whistles | |
| # ******************************************* |
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
| #!/bin/bash | |
| # | |
| # List branch status and age against an integration branch. | |
| # | |
| # Copyright (C) 2012 Julien Letessier | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy of | |
| # this software and associated documentation files (the "Software"), to deal in | |
| # the Software without restriction, including without limitation the rights to | |
| # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
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
| #!/bin/bash | |
| # | |
| # Close a feature branch - removing it from local and remote. | |
| # | |
| die() { | |
| echo "$@" ; exit 1 | |
| } | |
| head=$(git symbolic-ref HEAD 2> /dev/null || git log -1 --format=%h) |
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
| SELECT id,state,command,time,left(replace(info,'\n','<lf>'),120) | |
| FROM information_schema.processlist | |
| WHERE command <> 'Sleep' | |
| AND info NOT LIKE '%PROCESSLIST%' | |
| ORDER BY time DESC LIMIT 50; |
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
| # Originally from http://sharebear.co.uk/blog/2009/09/17/very-simple-python-caching-proxy/ | |
| # | |
| # Usage: | |
| # A call to http://localhost:80000/example.com/foo.html will cache the file | |
| # at http://example.com/foo.html on disc and not redownload it again. | |
| # To clear the cache simply do a `rm *.cached`. To stop the server simply | |
| # send SIGINT (Ctrl-C). It does not handle any headers or post data. | |
| import BaseHTTPServer | |
| import hashlib |
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
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
NewerOlder