Skip to content

Instantly share code, notes, and snippets.

View deploytoprod's full-sized avatar
🏠
Working from home

Rafael Lopes deploytoprod

🏠
Working from home
View GitHub Profile
'''MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
from requests_oauthlib import OAuth1Session
import urllib
CONSUMER_KEY = 'AAA'
CONSUMER_SECRET = 'BBB'
ACCESS_TOKEN = 'CCC'
ACCESS_SECRET = 'DDD'
# Above I put credentials for the App 'TwitterBoxRaf', App ID '16265219'
twitter = OAuth1Session(CONSUMER_KEY,
import json
import boto3
def crc(event, context):
""" Returns a CRC (Challenge Response Check) to keep this webhook
secure. https://goo.gl/kFdJgV for more details. """
# Short circuit ping from CloudWatch Events
if event.get('source', None) == 'aws.events':
print('ping')
return
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"name": "JSON Key - Level 0",
"scope": [
"source.json meta.structure.dictionary.json support.type.property-name.json"
],
"settings": {
"foreground": "#FF0000"
}
Elasticsearch info:
Elasticsearch Domain Name: es-domain
Number of nodes: 2
Disk space per node: 20 GB
Cluster type: Public but closed to my IP address
My IP address: 216.40.74.186
Domain name: es-domain
Cluster Endpoint: search-es-domain-dsbyregycjpium6ks4prehgjwy.us-west-2.es.amazonaws.com
{
"Version": "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Action" : [
"catalog-admin:*",
"servicecatalog:*",
"cloudformation:GetTemplateSummary",
"cloudformation:ValidateTemplate,",
x"],"turkishmalware":["analytics"],"pimpmywindow":["adse","adse2","fbquadradot","fbquadradofeeds","fb336f"],"tinynetwork":["faUnit1","_GPLITA_0","FACommonScript","FATransitionalScript","arxcastchrome"],"ice_ix":["jsess_script","wait_div"],"superfish":["superfish-script"],"guncelle_bepush_yokexe":["agenim","tistis"],"whitesmoke":["CLSCRIPT_7B4841EF_DAF5_4cb0_BC6F_0FB7A7C0CC7C_communicationDiv","CLSCRIPT_communicationDiv"]}, {"user_space_scripts":["__addEventListener"],"indo_friend":["penetrasi","addfriend"],"cereal":["cereziAl"],"arkadaslari":["arkadaslari_al"],"arkadas":["RandomArkadas"],"yorum":["yorum_yap"]}, {"pagerage":["leftCol"]}, {}, {});}); onloadRegister_DEPRECATED(function (){window.presenceRequests = require("m_0_9");});
@deploytoprod
deploytoprod / views.py
Created November 26, 2011 18:14
Passing entire object as parameter, instead of his id
from models import Post, Comment
from django.shortcuts import render
def posts(request):
posts = Post.objects.all()
return render(request, 'blog/posts.html', locals())
def post(request, id):
posts = Post.objects.all()
post = Post.objects.get(id=id) #Aqui eu tenho o objeto post, com todos os seus atributos