Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View SirPhemmiey's full-sized avatar
🎯
Focusing

Oluwafemi Akinde SirPhemmiey

🎯
Focusing
View GitHub Profile
@SirPhemmiey
SirPhemmiey / full_redis_playbook.yml
Created May 1, 2023 21:37
Full Ansible Playbook for Redis configuration
---
- name: Redis Installation
hosts: redis
become: true
tasks:
- name: Update package repositories
yum:
update_cache: yes
@SirPhemmiey
SirPhemmiey / full_vm_provision.yml
Created May 1, 2023 21:12
Full ansible playbook version to provision vm instance and allowing remote access to redis
- import_playbook: requirements.yml #you can find the file content in my gist
- name: Provision a GCP VM
hosts: localhost
gather_facts: false
vars:
gcp_cred_file: <your json service account>
gcp_project: <project-id>
machine_type: "e2-medium"
---
- hosts: localhost
connection: local
gather_facts: false
vars:
pip_package_requirements:
- "requests"
- "google-auth"
- "google-auth-httplib2"
---
- name: Redis Installation
hosts: redis
become: true
tasks:
- name: Update package repositories
yum:
update_cache: yes
@SirPhemmiey
SirPhemmiey / playbook.yml
Last active April 30, 2023 18:27
Basic Ansible code to create a VM instance on GCP
- import_playbook: requirements.yml
- name: Provision a GCP VM
hosts: localhost
gather_facts: false
vars:
gcp_cred_file: <path/to/serviceaccount/json/file>
gcp_project: <project-id>
machine_type: "e2-medium"
@SirPhemmiey
SirPhemmiey / typescript.json
Created February 7, 2021 09:11
Typescript.json
{
"Log info": {
"prefix": ["loginfo", "logger"],
"body": ["getLogger().info(${1:info})"],
"description": "Log info"
},
"Log error": {
"prefix": ["logerror"],
"body": ["getLogger().error(${1:error})"],
"description": "Log error"
@SirPhemmiey
SirPhemmiey / get_frozen_graph.py
Created January 30, 2020 08:42 — forked from Tony607/get_frozen_graph.py
How to run TensorFlow Object Detection model on Jetson Nano | DLology
import tensorflow as tf
def get_frozen_graph(graph_file):
"""Read Frozen Graph file from disk."""
with tf.gfile.FastGFile(graph_file, "rb") as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
return graph_def
# The TensorRT inference graph file downloaded from Colab or your local machine.

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

function minimumSwaps(arr) {
const visited = arr.slice(0).fill(false)
let swaps = 0;
for (let i = 0; i < arr.length; i++) {
const start = i;
let cycleFound = false;
let current = i;
let cycleLength = 0;
if (visited[current] === false) {
visited[i] = true;
@SirPhemmiey
SirPhemmiey / mysort.js
Created December 23, 2018 04:33 — forked from Samuelachema/mysort.js
Write a mySort function which takes in an array integers, and should return an array of the inputed integers sorted such that the odd numbers come first and even numbers come last.
/*
JavaScript
Write a mySort function which takes in an array integers, and should return an array of the inputed integers sorted such that the odd numbers come first and even numbers come last.
For exampl1e:
mySort( [90, 45, 66, 'bye', 100.5] )
should return
[45, 66, 90, 100]