Skip to content

Instantly share code, notes, and snippets.

View Neutrollized's full-sized avatar
🏠
Working from home

Glen Yu Neutrollized

🏠
Working from home
View GitHub Profile
@Neutrollized
Neutrollized / build_tensorflow2.md
Last active October 22, 2020 18:58
Compiling your own TensorFlow

Building Tensorflow from Source (TF 2.3.1, Ubuntu 20.04 & MacOS 10.15.7)

This should work for other TF versions 2.x, but mine was done for 2.3.1 specifically.

Hat tip to...

kmhoffmann's Gist about compiling TF 2.3.0 on Ubuntu 20.04 as that helped me get started with the steps I needed to start compling my own TF packaget started.

Introduction

There are many reasons to want to compile your own TF, but for me, I've been playing around with ML for a while myself and recently embarked on the TensorFlow journey. While trying to follow along to the [Predict Fuel Efficiency] regression problem, I ran into the following error: Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA and after a bit of Googling, I found that the default TF package that you install with pip is built without CPU extensions and so I had to compile my own if I wan

@Neutrollized
Neutrollized / mongodb_on_wsl.md
Last active April 14, 2021 05:04
MongoDB on WSL

Installing MongoDB on WSL

Even though Mongo says it doesn't support WSL, you can still make it work. Just install MongoDB as you would any regular Ubuntu system

If you tried to start it with systemctl start mongod, it will fail with an error like:

System has not been booted with systemd as init system (PID 1). Can't operate.

Well...if SystemD doesn't work, then use SystemV!

@Neutrollized
Neutrollized / markdown_to_pdf.md
Created April 15, 2021 21:58
Convert markdown to PDF

Install pandoc

brew install pandoc

How-To

The following will convert markdown file to a PDF file:

pandoc myfile.md -s -o myfile.pdf
@Neutrollized
Neutrollized / rbenv_macos_bigsur.md
Last active August 18, 2023 12:35
Installing Ruby with rbenv on MacOS Big Sur

Errors/Problems with Install

In attempting to install Ruby with rbenv, I ran into the following build failures:

BUILD FAILED (macOS 11.2.3 using ruby-build 20210423)

Inspect or clean up the working tree at /var/folders/58/16lnyx815c183j6wzcbl_thc0000gn/T/ruby-build.20210426232453.81982.XfAg0C
Results logged to /var/folders/58/16lnyx815c183j6wzcbl_thc0000gn/T/ruby-build.20210426232453.81982.log

Last 10 log lines:
 ^
@Neutrollized
Neutrollized / namespaces.yaml
Last active June 4, 2022 00:42
Medium: Getting started with GKE Gateway Controller
---
apiVersion: v1
kind: Namespace
metadata:
name: infra-ns
labels:
shared-gateway-access: "true"
---
apiVersion: v1
kind: Namespace
@Neutrollized
Neutrollized / main.py
Last active June 3, 2022 15:21
Medium: DIY Google Cloud Storage replication using Cloud Functions (copy_to_gcs)
import string
from google.cloud import storage
def copy_to_gcs(event, context):
print('Event ID: {}'.format(context.event_id))
print('Event type: {}'.format(context.event_type))
print('File: {}'.format(event['name']))
storage_client = storage.Client()
source_bucket = storage_client.bucket(event['bucket'])
@Neutrollized
Neutrollized / main.py
Created June 3, 2022 15:23
Medium: DIY Google Cloud Storage replication using Cloud Functions (delete_from_gcs)
import string
from google.cloud import storage
def delete_from_gcs(event, context):
print('Event ID: {}'.format(context.event_id))
print('Event type: {}'.format(context.event_type))
print('File: {}'.format(event['name']))
storage_client = storage.Client()
source_bucket = storage_client.bucket(event['bucket'])
@Neutrollized
Neutrollized / main.py
Created June 3, 2022 15:27
Medium: Managing your GCP inventory with Cloud Asset API (export_assets)
import base64
from google.cloud import asset_v1
def export_assets(event, context):
# create client
client = asset_v1.AssetServiceClient()
print("""This Function was triggered by messageId {} published at {} to {}
""".format(context.event_id, context.timestamp, context.resource["name"]))
# bq partition spec
@Neutrollized
Neutrollized / search_reserved_ip.py
Created June 3, 2022 15:31
Medium: Managing your GCP inventory with Cloud Asset API
def search_reserved_ips():
# create client
client = asset_v1.AssetServiceClient()
# init request
request = asset_v1.SearchAllResourcesRequest(
scope="projects/myproject-123",
asset_types=[
"compute.googleapis.com/Address",
],
@Neutrollized
Neutrollized / web.yaml
Created June 3, 2022 15:34
Medium: NGINX Ingress or GKE Ingress
---
apiVersion: v1
kind: Service
metadata:
labels:
app: web
name: web
annotations:
cloud.google.com/neg: '{"ingress": true}'
spec: