Skip to content

Instantly share code, notes, and snippets.

View oahayder's full-sized avatar

Omar Al-Hayderi oahayder

  • San Francisco
View GitHub Profile
alhaydo@C02ZV047MD6W openmath % python3 main.py
Hello! Please enter your age: 14
What's your favourite thing? football
If a football team scores 4 touchdowns and 5 field goals in a game, what is the total number of points earned?
43
Answer Grade: 10/10
@oahayder
oahayder / envoyfilter.yaml
Last active March 15, 2021 06:46
Istio Gateway EnvoyFilter
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: edge-lua-filter
spec:
workloadLabels:
app: ingressgateway
filters:
- listenerMatch:
portNumber: 443
@oahayder
oahayder / external_services.lua
Last active March 23, 2018 17:03
Require yeild workaround
local resty_dogstatsd = require "resty_dogstatsd"
--BAD. Module level objects
local dogstatsd, err = resty_dogstatsd.new({...})
-- GOOD. Construct connection at runtime
local function get_dogstatsd()
local dogstatsd, err = resty_dogstatsd.new({...})
return dogstatsd
end
@oahayder
oahayder / redis_ssl.lua
Last active March 28, 2018 22:40
SSL with lua-resty-redis
local redis_client, err = redis:new()
if not redis_client then
log(WARN, err)
return nil
end
redis_client:set_timeout(_redis_timeout)
local ok, err = redis_client:connect(_redis_host, _redis_port)
if not ok then
log(WARN, err)
ERROR:root:project_bucket_url missing!
ERROR:root:project_bucket_url missing!
ERROR:root:project_bucket_url missing!
ERROR:root:project_bucket_url missing!
ERROR:root:project_bucket_url missing!
ERROR:root:project_bucket_url missing!
WARNING:root:Error while copying asset f2702513-dba5-4101-b5fa-09811950a50e/525aaea9-823d-45e3-8731-6716e7b03bc6_t.png. Error: S3ResponseError: 404 NOT FOUND
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Errors>