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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Project Title</title> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| <meta name="viewport" content="width=device-width"> | |
| <meta name="description" content=""> | |
| <link rel="shortcut icon" href="favicon.ico"> |
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
| var oldSync = Backbone.sync; | |
| Backbone.sync = function(method, model, options){ | |
| options.beforeSend = function(xhr){ | |
| xhr.setRequestHeader('X-CSRFToken', CSRF_TOKEN); | |
| }; | |
| return oldSync(method, model, options); | |
| }; |
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
| /* | |
| * Template backbone.js code that encapsulates a | |
| * datatable.net table within a view for a hypothetical ;) | |
| * auction listings application. | |
| */ | |
| var HomeRouter = Backbone.Router.extend({ | |
| routes: { | |
| 'refresh' : 'refresh', |
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 | |
| # -*- coding: utf-8 -*- | |
| '''将搜狗拼音导出的文本词库转换成ibus-libpinyin的用户词典 | |
| by Conanca | |
| ''' | |
| content = open("搜狗词库导出_2014_1_6.txt").read().decode('utf16').encode('utf8') | |
| lines = content.split('\n') | |
| f=open('ibus.txt','w') |
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
| # list_detail.object_list replacement with all the things I need | |
| def object_list(request, queryset, extra_context=None, | |
| template_name='', paginate_by=None): | |
| class ObjectList(ListView): | |
| def post(self, request, *args, **kwargs): | |
| return self.get(request, *args, **kwargs) | |
| def get_context_data(self, **kwargs): | |
| c = super(ObjectList, self).get_context_data(**kwargs) |
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 sys | |
| import boto | |
| import boto.ec2 | |
| def _launchAWSInstances(): | |
| connection = boto.ec2.connect_to_region(AWS_REGION, aws_access_key_id = AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_ACCESS_KEY_SECRET) | |
| global reservation | |
| reservation = connection.run_instances(AWS_AMI, | |
| key_name=AWS_SSH_KEY_NAME, | |
| instance_type=AWS_INSTANCE_SIZE, |
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 boto.iam import IAMConnection | |
| iam = IAMConnection(aws_key, aws_secret) | |
| iam.create_user('user') | |
| iam.create_group('group') | |
| iam.put_group_policy('group', 'EC2', '{"Statement":[{"Effect":"Allow","Action":"ec2:*","Resource":"*"}]}') | |
| iam.add_user_to_group('group', 'user') | |
| iam.create_access_key('user') |
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
| # ec2utils: puppet recipes for use with Amazon's Elastic Compute Cloud (and | |
| # associated services) | |
| # | |
| # Copyright 2009 Flock, Inc. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 |
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
| <% if @banner -%><%= @banner -%><% end -%> | |
| +---------------------------------------- | |
| | | |
| | Host name: <%= node[:hostname] %> | |
| | FQDN: <%= node[:fqdn] %> | |
| | Distro / Arch: <%= node[:platform] %> <%= node[:platform_version] %> <%= node.kernel.machine %> | |
| <% if node.attribute?('applogic') -%> | |
| | App name: <%= node[:applogic][:APP_NAME] %> | |
| | Comp name: <%= node[:applogic][:COMP_NAME] %> | |
| <% end -%> |
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 ruby | |
| require 'aws-sdk' | |
| require 'pp' | |
| AWS.config(:proxy_uri => ENV['http_proxy']) | |
| config_path = File.expand_path(File.dirname(__FILE__)+"/keys.yml") | |
| AWS.config(YAML.load(File.read(config_path))) | |
| ec2 = AWS::EC2.new |