Skip to content

Instantly share code, notes, and snippets.

View alfredrumss's full-sized avatar

Alfredo Rivera alfredrumss

View GitHub Profile
@alfredrumss
alfredrumss / gist:2825008f0932c51b0d52e566a8ebc2fa
Created June 17, 2022 21:55
arrays aggregation with null or {} (empty) values
SELECT array_agg(DISTINCT cis.active_cert_record.hash) AS hash,
array_agg(DISTINCT cis.active_cert_record.domain_name) AS domain_name,
array_agg(DISTINCT cis.active_cert_record.protocol_version) AS protocol_version,
cis.active_cert_record.subject_organization,
cis.active_cert_record.subject_organizational_unit,
cis.active_cert_record.subject_common_name,
cis.active_cert_record.signature
FROM cis.active_cert_record
WHERE CAST(md5(cis.active_cert_record.signature) AS UUID) = 'xxxxx-xxx-xxxx-xxxx'
AND cis.active_cert_record.protocol_version <> '{}'
@alfredrumss
alfredrumss / credi
Last active February 26, 2019 23:30
import urllib, collections, hmac, hashlib, uuid, codecs
import urllib.parse
import urllib.request
#Payment url
PAYMENT_URL = 'https://migs.mastercard.com.au/vpcpay'
SECURE_SECRET = '5A7F9982DA5955FE2CAF9AB946C237EAXXX'
#Payment Data
@classmethod
def post(self, request, *args, **kwargs):
from .serializers import HomePageSerializer
from experience.serializers import ExperienceTranslation, ExperienceTranslationPerformanceDetailDateSerializer
from event.serializers import EventTranslation, EventTranslationPerformanceDetailDateSerializer
if 'HTTP_ACCEPT_LANGUAGE' in request.META.keys() and \
request.META.get('HTTP_ACCEPT_LANGUAGE') in \
dict(settings.LANGUAGES).keys():
def GetRoomsExtra(solutions, hotel):
return [ dict(solution, **{'room_extra': Room.objects.get(code=solution['rooms_details'][0]['room_code'], level__identifier=hotel)}) for solution in solutions]
$auth.authenticate(socialnetwork)
.then(function(response){
if(response.status == 200){
$auth.setToken(response.data.token)
loginAutentication(response)
}
})
.catch(function(data){
console.log(data)
(function () {
'use strict';
angular.module('visitbh').config(routerConfig);
/** @ngInject */
function routerConfig($stateProvider, $urlRouterProvider, $windowProvider) {
var $window = $windowProvider.$get();
$stateProvider
.state('app', {
class Departament(models.Model):
name = models.CharField(max_length=100)
description = models.CharField(max_length=500, blank=True)
status = models.BooleanField(default=False, blank=True)
created_at = models.DateTimeField(auto_now_add=True, blank=True)
def __unicode__(self):
return self.name
class Area(models.Model):
class CardsUserField(serializers.RelatedField):
def to_representation(self, value):
data = CardsSerializer(value)
return data.data
def to_internal_value(sef,data):
return data
class Meta: