Skip to content

Instantly share code, notes, and snippets.

View Timtech4u's full-sized avatar
🎯
Focusing

Timothy Olaleke Timtech4u

🎯
Focusing
View GitHub Profile
<template>
<button id="upload_widget" class="cloudinary-button">Update Logo</button>
</template>
<script>
methoods : {
uploadWidget() {
let myWidget = cloudinary.createUploadWidget(
{
@Timtech4u
Timtech4u / access_token.py
Last active November 17, 2019 21:54
Code snippet to return GCP's access token
import time
import jwt
import json
import requests
import httplib2
# Permissions to request for Access Token
scopes = "https://www.googleapis.com/auth/cloud-platform"
# Length of token's validity
@Timtech4u
Timtech4u / Dockerfile
Last active August 30, 2022 12:34
Snippet for Deploying Containers to Cloud Run Tutorial
FROM python:3.7-stretch
RUN apt-get update -y
RUN apt-get install -y python-pip python-dev build-essential
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py"]
/*
* GL05IdleFunc.cpp: Translation and Rotation
* Transform primitives from their model spaces to world space (Model Transform).
*/
// #include <windows.h> // for MS Windows
#include <GL/glut.h> // GLUT, include glu.h and gl.h
// Global variable
GLfloat angle = 0.0f; // Current rotational angle of the shapes
@Timtech4u
Timtech4u / index.js
Last active September 6, 2022 18:52
Cloud Function to Update Cloud Run Services
const request = require("request");
// Main function called by Cloud Functions trigger.
module.exports.updateCloudRunServices = (event, callback) => {
const build = eventToBuild(event.data);
// Check if push is to Dashboard source Code repo and if Cloud Build is successful
if (build.hasOwnProperty("source")) {
if (
build.source.repoSource.repoName === "dashboard" &&
def manipulate(obj_arr):
all_locations = []
result = []
for obj in obj_arr:
all_locations += obj['locations']
for location in all_locations:
location_products = {'location': location, 'associated_products': []}
for obj in obj_arr:
if location in obj['locations']:
location_products['associated_products'].append(obj['product'])
@Timtech4u
Timtech4u / index.js
Created July 11, 2019 00:41
Cloud Function Code for Blog Post :: Building a Slack Reminder App 🤖 with Google Cloud Functions ⚡ and Google Cloud Scheduler ⏰
const IncomingWebhook = require('@slack/webhook').IncomingWebhook;
const url = "https://hooks.slack.com/services/XYZ";
const webhook = new IncomingWebhook(url);
// Send the notification - Gets callled by Cloud Scheduler
module.exports.sendToSlack = () => {
(async () => {
await webhook.send({
icon_emoji: ':male-police-officer:',
@Timtech4u
Timtech4u / time.py
Created July 7, 2019 17:04
Datetime in Python like JS
from datetime import datetime, timezone
datetime.now(timezone.utc).isoformat()[:-9] + 'Z'
@Timtech4u
Timtech4u / cloudbuild.yaml
Created June 22, 2019 02:24
Multi Staged Deployment with Cloud Build
steps:
# build the container image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/projectz-239507/app', '.']
# push the container image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/projectz-239507/app']
# create database
- name: 'gcr.io/cloud-builders/gcloud'
args: ['sql', 'databases', 'create', 'mydb', '--instance', 'ddd']
@Timtech4u
Timtech4u / CONCURRENCY.md
Created June 21, 2019 00:38 — forked from montanaflynn/CONCURRENCY.md
Examples of sequential, concurrent and parallel requests in node.js

Concurrency in JavaScript

Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.