Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
- (void)uploadImage:(UIImage *)image | |
{ | |
//Set up the upload request from our server | |
NSURL *url = [NSURL URLWithString:@"http://<your-server-url-here>/"]; | |
NSURLRequest *request = [NSURLRequest requestWithURL:url]; | |
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { | |
// Pull out any required information out of the response | |
NSString *serverDate = [JSON valueForKeyPath:@"date_string"]; |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
-- a quick LUA access script for nginx to check IP addresses against an | |
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403. | |
-- | |
-- allows for a common blacklist to be shared between a bunch of nginx | |
-- web servers using a remote redis instance. lookups are cached for a | |
-- configurable period of time. | |
-- | |
-- block an ip: | |
-- redis-cli SADD ip_blacklist 10.1.1.1 | |
-- remove an ip: |
from rest_framework.views import exception_handler | |
def custom_exception_handler(exc): | |
""" | |
Custom exception handler for Django Rest Framework that adds | |
the `status_code` to the response and renames the `detail` key to `error`. | |
""" | |
response = exception_handler(exc) |
#!/bin/sh | |
# | |
# Pre-commit hook that verifies if all files containing 'vault' in the name | |
# are encrypted. | |
# If not, commit will fail with an error message | |
# | |
# File should be .git/hooks/pre-commit and executable | |
FILES_PATTERN='.*vault.*\.yml$' | |
REQUIRED='ANSIBLE_VAULT' |
I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.
What I decided on was the following: put your secret information into a vars
file, reference that vars
file from your task
, and encrypt the whole vars
file using ansible-vault encrypt
.
Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.
from flask import Flask, request, make_response | |
from datetime import datetime, timedelta | |
from twilio import twiml | |
app = Flask(__name__) | |
@app.route("/sms") | |
def sms(): | |
#get the cookie value, or default to zero |
from flask import Flask, request, make_response, session | |
from flaskext.kvsession import KVSessionExtension | |
from datetime import datetime, timedelta | |
from twilio import twiml | |
import json | |
import redis | |
from simplekv.memory.redisstore import RedisStore | |
SECRET_KEY = 'a secret key' |
# Problem: | |
# | |
# If you use git submodules linking two private github repos, you'll need to create a separate deploy key for each. | |
# Multiple keys are not supported by Ansible, nor does ansible (when running git module) resort to your `.ssh/config` file. | |
# This means your ansible playbook will hang in this case. | |
# | |
# You can however use the ansible git module to checkout your repo in multiple steps, like this: | |
# | |
- hosts: webserver | |
vars: |
FROM ansible/centos7-ansible:stable | |
# or, for example, FROM ansible/ubuntu14.04-ansible:stable | |
RUN yum install -y tar | |
RUN ansible-galaxy install geerlingguy.java | |
RUN ansible-galaxy install https://github.com/silpion/ansible-maven.git | |
# Add playbooks to the Docker image | |
COPY site.yml / |