Skip to content

Instantly share code, notes, and snippets.

Avatar
🎸
Managing incidents

Ramindu Deshapriya ramdesh

🎸
Managing incidents
View GitHub Profile
@ramdesh
ramdesh / keras_model_s3_wrapper.py
Created Dec 8, 2020
Save and load Keras models to and from AWS S3
View keras_model_s3_wrapper.py
import s3fs
import zipfile
import tempfile
import numpy as np
from tensorflow import keras
from pathlib import Path
import logging
AWS_ACCESS_KEY="aws_access_key"
View .pre-commit-config.yaml
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.6
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
- id: trailing-whitespace
@ramdesh
ramdesh / gdrive_img_url.js
Created Apr 2, 2018
GDrive view image sharing url
View gdrive_img_url.js
var url = "https://drive.google.com/uc?export=download&id=18uDNHqzEK3DrxcFhL5SjU4zpGCqOq53R";
@ramdesh
ramdesh / lambda_tg_bot_trigger.js
Created Mar 18, 2018
Lambda Telegram Trigger
View lambda_tg_bot_trigger.js
var http = require('https');
var AWS = require('aws-sdk');
exports.handler = (event, context) => {
var codecommit = new AWS.CodeCommit({ apiVersion: '2015-04-13' });
var baseUrl = "https://api.telegram.org/bot416356188:AAGaWMHjEXsxTmXb4c6GAsIkLbpwpWMUMzs/sendMessage?chat_id=-283837997&text=";
//Log the updated references from the event
var commits = event.Records[0].codecommit.references.map(
@ramdesh
ramdesh / vesuvius_t()_bash
Created Aug 20, 2012
Checking for strings in Sahana Vesuvius which haven't been enclosed in a _t() function
View vesuvius_t()_bash
grep -nr --include="*.php" "'" ~/vesuvius | grep -Ev "_t\(\"|_t\(\'|\[\"|\[\'|//|/\*|\*|\*/|SELECT|UPDATE|INSERT|DELETE|WHERE|VALUE|VALUES|ADD" >single-quote-greps.txt
grep -nr --include="*.php" '"' ~/vesuvius | grep -Ev "_t\(\"|_t\(\'|\[\"|\[\'|//|/\*|\*|\*/|SELECT|UPDATE|INSERT|DELETE|WHERE|VALUE|VALUES|ADD" >double-quote-greps.txt