Skip to content

Instantly share code, notes, and snippets.

View Timtech4u's full-sized avatar
🎯
Focusing

Timothy Olaleke Timtech4u

🎯
Focusing
View GitHub Profile
@Timtech4u
Timtech4u / countries.geojson
Last active August 21, 2023 09:11
Feature Collection of Countries
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
FROM node:8.9.4-alpine
RUN apk add --no-cache git
RUN npm install -g yo generator-hubot
RUN adduser -D hubot
USER hubot
WORKDIR /home/hubot
RUN yo hubot --owner="Tim <timothy@fireflies.ai>" --name="hubot" --description="Hubot for slack" --adapter="slack" --defaults
RUN npm install --save hubot-slack
RUN npm install --save hubot-google-images
RUN npm install --save hubot-google-translate
confirmations:
required: 4 # choose the number of confirmations you require
policyengine.simple:
fixedGasPrice: null
gasOracle:
mode: connector
@Timtech4u
Timtech4u / cloudbuild.yaml
Created January 12, 2021 07:20
Generic Cloud Build
steps:
# build and push container
- name: "gcr.io/kaniko-project/executor:latest"
args: ["--cache=true", "--cache-ttl=48h", "--destination=gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME"]
# deploy container image to Cloud Run with env vars
- name: "gcr.io/cloud-builders/gcloud"
args: ['run', 'deploy', '$REPO_NAME', '--image', 'gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME', '--region', 'europe-west4', '--allow-unauthenticated', '--platform', 'managed', '--update-env-vars', 'NODE_ENV=prod']
# set full traffic to latest revision (needed if rollback was performed)
- name: "gcr.io/cloud-builders/gcloud"
args: ['run', 'services', 'update-traffic', '$REPO_NAME', '--to-latest', '--region', 'europe-west4', '--platform', 'managed']
@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" &&
@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"]
@Timtech4u
Timtech4u / index.html
Created August 30, 2017 01:12
vuejs firebase list
<div id="app">
<h2>Firebase List</h2>
<div v-for="item in items" class="item">
<button @click="removeItem(item)">&times;</button> {{item.value}} <small>{{new Date(item.ts).toGMTString()}}</small>
</div>
<div>
<form><input v-model="tempItem"><button @click="addItem(tempItem); tempItem = ''" :disabled="tempItem===''"> + </button> </form>
</div>
</div>
@Timtech4u
Timtech4u / bday.py
Created November 12, 2016 23:35
Happy Birthday Codes in Python.
#!/usr/bin/python
import curses
import random
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(1)
curses.halfdelay(1)
@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 / dps.jinja
Last active July 29, 2020 13:21
Firewall and a Startup Script with Deployment Manager
imports:
- path: install-web.sh
name: install-web.sh
resources:
- name: default-allow-http
type: compute.v1.firewall
properties:
sourceRanges: ["0.0.0.0/0"]
targetTags: ["http-server"]
allowed: