Skip to content

Instantly share code, notes, and snippets.

View narenaryan's full-sized avatar
🏠
Dreaming Big

N3N narenaryan

🏠
Dreaming Big
View GitHub Profile
@gaqzi
gaqzi / test_views.py
Last active March 12, 2021 08:29
SNS subscription and handler for django
import re
from django.core.urlresolvers import reverse
import responses
AWS_URL = re.compile('.*amazonaws.com.*')
class TestSNSSubscription(object):
@amosshapira
amosshapira / get-all-s3-prefix-lists
Created December 2, 2015 03:54
Fetch the S3 prefix list ID's for S3 in all AWS regions. These are can then be used as destinations in route tables
#!/bin/bash
# Fetch the S3 prefix list ID's for S3 in all AWS regions.
# These are can then be used as destinations in route tables
aws ec2 describe-regions --query 'Regions[*].RegionName' | \
jq -r '.[]' | \
while read REGION
do
echo ==== $REGION ====
@chantastic
chantastic / on-jsx.markdown
Last active May 30, 2024 13:11
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@narenaryan
narenaryan / FreshdeskSSO.py
Last active August 29, 2015 14:15
Freshdesk SSO remote login django view sample script
# Create your views here.
from django.shortcuts import render,redirect
from django.contrib.auth import authenticate
from datetime import datetime
import hmac
def ticket_login(request):
if request.method == 'GET':
return render(request, 'ticketing/login.html')
@moqada
moqada / graph.py
Created December 19, 2014 05:50
pygal sample on flask
# -*- coding: utf-8 -*-
import pygal
from flask import Flask, Response
app = Flask(__name__)
@app.route('/')
def index():
@justqyx
justqyx / pg_timezone_names.txt
Created April 24, 2014 08:05
select * from pg_timezone_names;
name | abbrev | utc_offset | is_dst
----------------------------------+--------+------------+--------
Africa/Abidjan | GMT | 00:00:00 | f
Africa/Accra | GMT | 00:00:00 | f
Africa/Addis_Ababa | EAT | 03:00:00 | f
Africa/Algiers | CET | 01:00:00 | f
Africa/Asmara | EAT | 03:00:00 | f
Africa/Asmera | EAT | 03:00:00 | f
Africa/Bamako | GMT | 00:00:00 | f
Africa/Bangui | WAT | 01:00:00 | f
@kellyelton
kellyelton / gist:8776309
Created February 2, 2014 23:01
Freshdesk c# sso /w timestamp
public ActionResult HelpLogin()
{
const string key = "abcdefghijklmnopqrtuvwxyz";
const string pathTemplate = "http://demo.freshdesk.com/login/sso?name={0}&email={1}&timestamp={2}&hash={3}";
var username = UserHelper.CurrentUser.UserName;
var email = UserHelper.CurrentUser.Email;
string timems = (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds.ToString();
var hash = GetHash(key, username, email, timems);