Skip to content

Instantly share code, notes, and snippets.

View babo's full-sized avatar

Attila Babo babo

View GitHub Profile
@babo
babo / pubsub_cleaner.py
Last active September 14, 2020 09:51
Delete a specific message
import json
from google.cloud import pubsub
# Instantiates a client
pubsub_client = pubsub.Client()
sbscr = pubsub_client.subscription('demoapi_subscription_createTenant')
i = 0
while True:
for x in sbscr.pull(return_immediately=True):
import json
def respond(res, statusCode=200):
return {
'statusCode': statusCode,
'body': res if isinstance(res, (type(None), str, bytes, bytearray)) else json.dumps(res),
'headers': {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'
},
diff --git i/FusionEKF.cpp w/FusionEKF.cpp
index 5092324..93b0cc5 100644
--- i/FusionEKF.cpp
+++ w/FusionEKF.cpp
@@ -37,8 +37,8 @@ FusionEKF::FusionEKF() {
0, 0.0225;
- double noise_ax = 9; // x uncertainty added
- double noise_ay = 9; // y uncertainty added
#!/usr/bin/perl -w
# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not
# use this file except in compliance with the License. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
@babo
babo / mit.js
Last active January 19, 2017 22:13
//<![CDATA[
// a few things don't have var in front of them - they update already existing variables the game needs
// Input is 7 lanes, security is 5 slots back and 6 ahead
lanesSide = 2;
patchesAhead = 11;
patchesBehind = 6;
trainIterations = 10000;
var num_inputs = (lanesSide * 2 + 1) * (patchesAhead + patchesBehind);
@babo
babo / img_import.py
Created January 5, 2017 14:14
Import images using cv2
import os
import cv2
import numpy as np
own_pictures = []
dirname = './extra_images/'
for fn in os.listdir(dirname):
try:
import os
import PIL
import PIL.Image
import PIL.ImageOps
import numpy as np
print('Number of images before: {}'.format(X_train.shape[0]))
@babo
babo / overload.sh
Last active September 22, 2016 11:05
On AWS the metadata service is rate limited. The code below overloads the system pretty fast, returning an HTTP 429 error code
#!/bin/sh
set -e
ZONE=$(curl http://169.254.169.254/latest/meta-data/placement/availability-zone 2>/dev/null)
failed() {
echo Failed after ${X}
exec curl http://169.254.169.254/latest/meta-data/placement/availability-zone
}
@babo
babo / readonly.sql
Last active July 6, 2016 12:08
Minimal example how to create a read only group and a time limited user in Redshift. In the example the password is defined with MD5 hash. To generate the actual value you need to concatenate the word md5 with the md5 hash of a composite string, the concatenation of the actual password and the username. For reference the password at this example…
CREATE GROUP read_only;
REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM GROUP read_only;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO GROUP read_only;
CREATE USER
time_limited_reader
WITH
PASSWORD 'md5b3d32f5a247d71dd338a1effa3976ede'
IN GROUP read_only
#!/usr/bin/env python3
import json
import boto3
def main():
all_ec2 = {}
all_rds = {}
all_cache = {}
all_elb = {}