Skip to content

Instantly share code, notes, and snippets.

View ramdesh's full-sized avatar
🎸
Managing incidents

Ramindu Deshapriya ramdesh

🎸
Managing incidents
View GitHub Profile
@ramdesh
ramdesh / vesuvius_t()_bash
Created August 20, 2012 07:06
Checking for strings in Sahana Vesuvius which haven't been enclosed in a _t() function
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
@ramdesh
ramdesh / lambda_tg_bot_trigger.js
Created March 18, 2018 14:48
Lambda Telegram Trigger
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 / gdrive_img_url.js
Created April 2, 2018 06:30
GDrive view image sharing url
var url = "https://drive.google.com/uc?export=download&id=18uDNHqzEK3DrxcFhL5SjU4zpGCqOq53R";
@ramdesh
ramdesh / .pre-commit-config.yaml
Created June 23, 2020 20:46
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 / keras_model_s3_wrapper.py
Created December 8, 2020 21:56
Save and load Keras models to and from AWS S3
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"