Skip to content

Instantly share code, notes, and snippets.

View bettdouglas's full-sized avatar
💭
Available

Douglas Bett bettdouglas

💭
Available
View GitHub Profile
@bettdouglas
bettdouglas / envoy.yml
Created January 24, 2023 01:22
Envoy proxy for Cloud Run to enable gRPC Web Clients to connect. We only have one Cluster
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 8080 }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
@bettdouglas
bettdouglas / get_countries_centroid_and_country_code.py
Created May 15, 2021 14:41
A quick snippet to find country_code and centroid from natural earth dataset
url = 'https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip'
#!pip install wget
import wget
# download countries_data set
filename = wget.download(url)
ctry = 'Japan'
@bettdouglas
bettdouglas / constants.dart
Last active February 11, 2021 22:18
Connection constants to point to our server
final options = ChannelOptions(
credentials: ChannelCredentials.insecure(), // we're not using TLS
connectionTimeout: Duration(milliseconds: 500),
idleTimeout: Duration(
milliseconds: 500,
),
);
final clientChannel = ClientChannel(
'0.0.0.0', // host the server is running on
latest=version12
@bettdouglas
bettdouglas / static-methods.dart
Created March 18, 2020 12:23
How to reuse a method used in another Widget
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
@bettdouglas
bettdouglas / example.dart
Created February 7, 2020 11:57 — forked from sma/example.dart
A flutter example demonstrating a custom painter drawing selectable rects
class RectsExample extends StatefulWidget {
@override
_RectsExampleState createState() => _RectsExampleState();
}
class _RectsExampleState extends State<RectsExample> {
int _index = -1;
@override
Widget build(BuildContext context) {
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@bettdouglas
bettdouglas / PY0101EN-4-1-ReadFile.ipynb
Created September 21, 2019 14:23
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bettdouglas
bettdouglas / PY0101EN-3-4-Classes.ipynb
Created September 21, 2019 12:33
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bettdouglas
bettdouglas / PY0101EN-3-3-Functions.ipynb
Created September 21, 2019 12:05
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.