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
#!flask/bin/python | |
from flask import Flask, jsonify, abort, request, make_response, url_for | |
from flask_httpauth import HTTPBasicAuth | |
app = Flask(__name__, static_url_path = "") | |
auth = HTTPBasicAuth() | |
@auth.get_password | |
def get_password(username): | |
if username == 'miguel': |
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 | |
#Set colour prompt using the name, platform or instance id and avzone | |
if [ ! -f "/opt/aws/AWS-INSTID" ]; then | |
curl -s --fail http://169.254.169.254/latest/meta-data/instance-id > /opt/aws/AWS-INSTID | |
fi | |
export INSTID=`cat /opt/aws/AWS-INSTID` | |
if [ ! -f "/opt/aws/AWS-AVZONE" ]; then | |
curl -s --fail http://169.254.169.254/latest/meta-data/placement/availability-zone > /opt/aws/AWS-AVZONE |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'aws-sdk' | |
instance_id = `wget "http://169.254.169.254/latest/meta-data/instance-id" -o /dev/null -O /dev/stdout` | |
config = {:access_key_id => '', | |
:secret_access_key => ''} | |
AWS.config(config) | |
ec2 = AWS::EC2.new | |
ec2 = ec2.regions['ap-northeast-1'] |
To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo
if you're logged in as root.
-
Edit
/etc/ssh/sshd_config
and make sure to add the following at the end of the file:Match group filetransfer
ChrootDirectory %h
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/sh -e | |
#git-cache-meta -- simple file meta data caching and applying. | |
#Simpler than etckeeper, metastore, setgitperms, etc. | |
#from http://www.kerneltrap.org/mailarchive/git/2009/1/9/4654694 | |
#modified by n1k | |
# - save all files metadata not only from other users | |
# - save numeric uid and gid | |
# 2012-03-05 - added filetime, andris9 |
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 lxml.html | |
html = lxml.html.parse("http://pypi.python.org/pypi") # can take an url, a filename or an object with a .read() method | |
packages = html.xpath('//tr/td/a/text()') # get the text inside all "<tr><td><a ...>text</a></td></tr>" | |
print packages | |
Out[7]: | |
[u'celery\xa02.2.3', | |
u'django-celery\xa02.2.3', | |
u'kombu\xa01.0.3', |
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
LocalCommand echo -ne "\033]0;"%r@%h"\007" | |
PermitLocalCommand yes |
NewerOlder