Search and replace ' with " from the current cursor postion to the end of the file.
:,$s/'/"/gc
| from flask import Flask | |
| from .mongoflask import MongoJSONEncoder, ObjectIdConverter | |
| from .db import get_db | |
| def create_app(): | |
| app = Flask(__name__) | |
| app.json_encoder = MongoJSONEncoder | |
| app.url_map.converters['objectid'] = ObjectIdConverter | |
| # Client sends their string, we interpret it as an ObjectId |
| import argparse | |
| import base64 | |
| import os | |
| import zlib | |
| from pathlib import Path | |
| def convert(s): | |
| b = base64.b64decode(s.encode('ascii')) | |
| return zlib.decompress(b).decode('utf-8') |
| #!/usr/bin/env bash | |
| STACK_NAME=$1 | |
| STACK_PATH=$2 | |
| if [ -z "$1" ] | |
| then | |
| echo "No STACK_NAME argument supplied" | |
| exit 1 | |
| fi |
| #!/usr/bin/env bash | |
| STACK_NAME=$1 | |
| if [ -z "$1" ] | |
| then | |
| echo "No STACK_NAME argument supplied" | |
| exit 1 | |
| fi |
| - PolicyName: "s3SyncTaskPolicy" | |
| PolicyDocument: | |
| Version: 2012-10-17 | |
| Statement: | |
| - Effect: Allow | |
| Action: | |
| - s3:DeleteObject | |
| - s3:ListBucket | |
| - s3:GetObject | |
| - s3:GetBucketLocation |
| import argparse | |
| parser = argparse.ArgumentParser(prog='cl') | |
| subparsers = parser.add_subparsers() | |
| def foo(beep, boop): | |
| print beep, boop | |
| def bar(baz): | |
| print baz |
| import yaml | |
| import json | |
| import pandas as pd | |
| df = pd.DataFrame({'one': [1.0, 2.1, 3.2], 'two': [4.3, 5.4, 6.5]}) | |
| with open('df.yml', 'w') as file: | |
| yaml.dump({'result': json.loads(df.to_json(orient='records'))}, file, default_flow_style=False) |
| # Stop all docker process | |
| docker stop $(docker ps -a -q) | |
| # rm all docker containers | |
| docker rm $(docker ps -a -q) | |
| # rm all docker images with some selection logic | |
| docker rmi $(docker images --format "{{.Repository}}:{{.Tag}}") | |
| # or |
| // Beautiful regex patterns that parse and validate complex querystring parameter of search terms | |
| const searchSyntaxValidationRegex = /^([^:]+:[^:]+(?:,|$))+$/; | |
| const searchSyntaxParseRegex = /([^:]+):\(([^(]+)\)(?:,|$)/g; | |
| /** | |
| * Parses comma separated list of key values into an object. | |
| * | |
| * IN: | |
| * title:(bar bar),content_stripped:(baz, and qux),other:(beep boop) | |
| * |