Skip to content

Instantly share code, notes, and snippets.

View alpinstang's full-sized avatar
🏠
Working from home eternally

John McDonald alpinstang

🏠
Working from home eternally
View GitHub Profile
@alpinstang
alpinstang / reverse-string.js
Created February 9, 2021 23:03
Example to reverse a string in JS
// given a string 'Hello my name is John.'
// reverse it
// output should be '.nhoJ si eman ym olleH
const s = 'Hello my name is John.';
function reverseString(string) {
string = string.split('');
string.reverse();
return string.toString('').replace(/,/g, '');
@alpinstang
alpinstang / SlackFileCleaner.py
Last active May 14, 2018 02:10
Delete Slack files older than 30 days AWS Lambda ready. Just add a CloudFormation rule to run this periodically. Rewrite of https://gist.github.com/jackcarter/d86808449f0d95060a40 which is a rewrite of https://gist.github.com/jamescmartinez/909401b19c0f779fc9c1
import os
from botocore.vendored import requests
import time
import json
# set an environment variable when creating your lambda for your Slack key:
token = os.environ['LEGACY_KEY']
#Delete files older than 30 days:
ts_to = int(time.time()) - 30 * 24 * 60 * 60
def list_files():