Skip to content

Instantly share code, notes, and snippets.

View kevinmcmahon's full-sized avatar

Kevin McMahon kevinmcmahon

View GitHub Profile
private boolean isServiceRunning() {
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)){
if("com.example.MyNeatoIntentService".equals(service.service.getClassName())) {
return true;
}
}
return false;
}
@kevinmcmahon
kevinmcmahon / chrome-extension-oauth-client.js
Created November 24, 2024 19:29
Bluesky Chrome Extension OAuth Client
import { OAuthClient } from '@atproto/oauth-client';
import { ChromeExtensionStorage } from '../chrome-extension-storage';
import { ChromeExtensionOAuthDatabase } from './chrome-extension-oauth-database';
import { ChromeExtensionRuntimeImplementation } from './chrome-extension-runtime-implementation';
const NAMESPACE = `@@oauth-client-chrome-extension`;
/**
* Extends the OAuthClient class to provide a Chrome extension-specific implementation.
* This class handles the OAuth flow and caching for a Chrome extension application.
@kevinmcmahon
kevinmcmahon / gist:1584998
Created January 9, 2012 21:21
Updating the landmarks table to set the_geom column with POINT data.
UPDATE landmarks
SET the_geom = ST_GeomFromText('POINT(' || longitude || ' ' || latitude || ')',4326);
@kevinmcmahon
kevinmcmahon / deploy-spa.cjs
Created November 1, 2023 17:51
Quick script to deploy a SPA to a S3 bucket. Extracted from aws-samples/amazon-cognito-passwordless-auth and tweaked.
#!/usr/bin/env node
process.env.AWS_SDK_LOAD_CONFIG = '1';
const {default: s3SpaUpload} = require('s3-spa-upload');
const fs = require('fs');
const path = require('path');
const proc = require('node:child_process');
proc.execFileSync('yarn', ['run', 'build', ...process.argv.slice(2)], {
cwd: __dirname,
@kevinmcmahon
kevinmcmahon / Base64.sol
Created February 21, 2022 16:29 — forked from ryancharris/Base64.sol
Solidity Base64 utilities
pragma solidity >=0.8.0 <0.9.0;
// SPDX-License-Identifier: MIT
/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <brecht@loopring.org>
library Base64 {
bytes internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@kevinmcmahon
kevinmcmahon / gist:2295471
Created April 3, 2012 20:59
Create a 1x1 UIImage from a UIColor
- (UIImage *)imageWithColor:(UIColor *)color {
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

re:Invent 2019 Workshops

A list of public repositories, content, and web from re:Invent 2019 Workshops. Many of the links are subject to be moved or completely removed at any point in time in the future.

Session ID Session Name Repo/Site
SVS203 Build a serverless ride-sharing web application https://webapp.serverlessworkshops.io/
SVS340 Serverless image processing workflows at scale with AWS Step Functions https://image-processing.serverlessworkshops.io/
AIM362 Build, train & debug, and deploy & monitor with Amazon SageMaker http://bit.ly/aim362-workshop
GPSTEC406 AWS Alien Attack workshop https://alienattack.workshop.aws/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kevinmcmahon
kevinmcmahon / gist:1584721
Last active December 15, 2019 23:08
Create a PostgreSQL table to hold the Individual_Landmarks.csv data
CREATE TABLE landmarks
(
gid serial NOT NULL,
name character varying(50),
address character varying(50),
date_built character varying(10),
architect character varying(50),
landmark character varying(10),
latitude double precision,
longitude double precision,