Skip to content

Instantly share code, notes, and snippets.

@ggmartins
ggmartins / aws_eks_config
Created January 26, 2021 16:46 — forked from tobemedia/aws_eks_config
EKS DNS Workaround
# file: aws_eks_config.yml
# AWS EKS ClusterConfig used to setup the BinderHub / JupyterNotebooks K8s cluster
# using a workaround from https://discourse.jupyter.org/t/binder-deployed-in-aws-eks-domain-name-resolution-errors/766/10
# to fix broken DNS resolution
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks-dns-production
@ggmartins
ggmartins / describe-python.py
Created July 22, 2020 17:50 — forked from jeetsukumaran/describe-python.py
Provides information about your Python installation(s).
#! /usr/bin/env python
import subprocess
import optparse
import os
import sys
__version__ = "1.0.0"
__author__ = "Jeet Sukumaran"
@ggmartins
ggmartins / tfgpucheck.py
Last active August 29, 2022 18:14
tensorflow gpu check
#!/usr/bin/env python
import tensorflow as tf
print(tf.__version__)
if tf.test.gpu_device_name():
print('Default GPU Device:{}'.format(tf.test.gpu_device_name()))
else:
print("Please install GPU version of TF")
#!/usr/bin/env python3
from http.server import HTTPServer, SimpleHTTPRequestHandler, test
import sys
class CORSRequestHandler (SimpleHTTPRequestHandler):
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
self.send_header('Access-Control-Allow-Headers', 'origin, content-type, accept, authorization')
self.send_header('Access-Control-Allow-Methods', 'GET, POST, HEAD, OPTIONS')
self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate')
@ggmartins
ggmartins / index.html
Created April 29, 2020 23:42
metatags 2020 example
<title>Mac Pro - Apple</title>
<meta name="title" content="Mac Pro - Apple">
<meta name="description" content="The all-new Mac Pro. Redesigned for extreme performance, expansion, and configurability, it’s a system for pros to push the limits of what is possible.">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://www.apple.com/mac-pro/">
<meta property="og:title" content="Mac Pro - Apple">
<meta property="og:description" content="The all-new Mac Pro. Redesigned for extreme performance, expansion, and configurability, it’s a system for pros to push the limits of what is possible.">
<meta property="og:image" content="https://www.apple.com/v/mac-pro/f/images/meta/og__o8wgegujpmaq.jpg?202004131555">
@ggmartins
ggmartins / index.html
Created April 10, 2020 04:51 — forked from gaearon/index.html
Multiple React components on a single HTML page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@ggmartins
ggmartins / gist:e369364963e89165a98f898ba7fa2a85
Created January 10, 2020 21:59 — forked from mnordhoff/gist:2213179
Python regular expressions for IPv4 and IPv6 addresses and URI-references, based on RFC 3986's ABNF.The URI-reference regular expression includes IPv6 address zone ID support (RFC 6874).
# Python regular expressions for IPv4 and IPv6 addresses and URI-references,
# based on RFC 3986's ABNF.
#
# ipv4_address and ipv6_address are self-explanatory.
# ipv6_addrz requires a zone ID (RFC 6874) follow the IPv6 address.
# ipv6_address_or_addrz allows an IPv6 address with optional zone ID.
# uri_reference is what you think of as a URI. (It uses ipv6_address_or_addrz.)
import re
@ggmartins
ggmartins / db_to_csv.psql
Created November 13, 2019 19:35
PostgresSQL database to CSV
CREATE OR REPLACE FUNCTION db_to_csv(path TEXT) RETURNS void AS $$
declare
tables RECORD;
statement TEXT;
begin
FOR tables IN
SELECT (table_schema || '.' || table_name) AS schema_table
FROM information_schema.tables t INNER JOIN information_schema.schemata s
ON s.schema_name = t.table_schema
WHERE t.table_schema NOT IN ('pg_catalog', 'information_schema')
@ggmartins
ggmartins / lottery_numbergen.sh
Created May 3, 2019 14:59
Lottery / Megasena Number Generator for python one liners
python3 -c "import random as r,time as t,os;r.seed(t.time);x=[r.randint(1,60) for i in range(6)];x.sort();print(x)"
@ggmartins
ggmartins / golang_on_rpi.md
Last active May 10, 2018 20:25 — forked from konradko/golang_on_rpi.md
Install Golang 1.10.2 on Raspberry Pi
wget https://storage.googleapis.com/golang/go1.10.2.linux-armv6l.tar.gz
sha256sum go1.10.2.linux-armv6l.tar.gz
echo 529a16b531d4561572db6ba9d357215b58a1953437a63e76dc0c597be9e25dd2
sudo tar -C /usr/local -xzf go1.10.2.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin