If this codebase is production, handles money, or touches sensitive data: treat this audit loop as a high-risk operation. Run with least privilege, avoid exporting long-lived credentials in your shell, and keep the agent in read-only mode.
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
| { | |
| "content_scripts": [ | |
| { | |
| "matches": ["http://*/*", "https://*/*"], | |
| "js": ["inject.js"], | |
| "all_frames": true | |
| } | |
| ], | |
| "web_accessible_resources": [ | |
| "content.js" |
I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.
So it might be really unintuitive at first but lambda functions have three states.
- No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
- VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
- VPC with NAT, The best of both worlds, AWS services and web.
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
| // use this format since .eslintrc is deprecated. | |
| // You can logically derive this format. | |
| module.exports = { | |
| parser: 'babel-eslint', | |
| extends: [ | |
| 'plugin:flowtype/recommended', | |
| 'plugin:jest/recommended', | |
| 'plugin:react/recommended', | |
| 'eslint-config-airbnb', |
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
| // 1. Define a state variable for showing/hiding the action-button | |
| state = { | |
| isActionButtonVisible: true | |
| } | |
| // 2. Define variables those will keep track of the current scroll position, height and content height | |
| _listViewOffset = 0 | |
| _listViewHeight = 0 | |
| _listViewContentHeight = 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
| import os | |
| def is_ec2_linux(): | |
| """Detect if we are running on an EC2 Linux Instance | |
| See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/identify_ec2_instances.html | |
| """ | |
| if os.path.isfile("/sys/hypervisor/uuid"): | |
| with open("/sys/hypervisor/uuid") as f: | |
| uuid = f.read() |
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 tempfile | |
| from io import BytesIO | |
| from PIL import Image | |
| def get_test_image(): | |
| file = BytesIO() | |
| image = Image.new('RGBA', size=(50, 50), color=(155, 0, 0)) | |
| image.save(file, 'png') |
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 PYTHONIOENCODING=utf-8 python | |
| # encoding: utf-8 | |
| """Git pre-commit hook which lints Python, JavaScript, SASS and CSS""" | |
| from __future__ import absolute_import, print_function, unicode_literals | |
| import os | |
| import subprocess | |
| import sys |
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
| # Views | |
| from rest_framework.generics import CreateAPIView | |
| from rest_framework.response import Response | |
| class PasswordInitializeAPIView(CreateAPIView): | |
| serializer_class = serializers.PasswordInitSerializer | |
| def create(self, request, *args, **kwargs): | |
| self.check_permissions(request) | |
| serializer = self.get_serializer(data=request.data) |
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 django.utils import timezone | |
| from rest_framework import serializers | |
| class DateToTimestampField(serializers.Field): | |
| def to_representation(self, value): | |
| epoch = timezone.datetime(1970, 1, 1) | |
| value = timezone.datetime.fromordinal(value.toordinal()) | |
| return int((value - epoch).total_seconds()) * 1000 |
NewerOlder