Skip to content

Instantly share code, notes, and snippets.

View sloanlance's full-sized avatar
Certified GitHub Pro

Mr. Lance E Sloan sloanlance

Certified GitHub Pro
View GitHub Profile
@sloanlance
sloanlance / IPA Reader Lambda (S3).py
Created April 4, 2023 16:10 — forked from katie7r/IPA Reader Lambda (S3).py
IPA Reader Lambda function (with S3 storage of saved audio files)
import boto3
import os
from contextlib import closing
from botocore.exceptions import ClientError
def object_exists(s3, bucket, key):
try:
boto3.resource('s3').Object(bucket, key).load()
return True
#!/bin/sh
awk 'function wl() {
rate=64000;
return (rate/160)*(0.87055^(int(rand()*10)))};
BEGIN {
srand();
wla=wl();
while(1) {
wlb=wla;
wla=wl();
@sloanlance
sloanlance / ngrok_public_url.sh
Last active August 25, 2020 18:00 — forked from lsloan/ngrok_public_url.sh
Get the local ngrok public URL, which includes the hostname, extracted using jq
#!/bin/sh --
# Get the local ngrok public URL, which includes the hostname, extracted using jq
# Inspiration: https://gist.github.com/rjz/af40158c529d7c407420fc0de490758b#gistcomment-2594627
curl --silent http://127.0.0.1:4040/api/tunnels | jq -r '.tunnels[0].public_url'
@sloanlance
sloanlance / Jekyll & Liquid Cheatsheet
Last active September 17, 2022 11:33 — forked from magicznyleszek/jekyll-and-liquid.md
Jekyll & Liquid Cheatsheet (A fork of the gist by "magicznyleszek", FKA "smutnyleszek")
See: `Jekyll & Liquid Cheatsheet.md`
@sloanlance
sloanlance / pythonista_compile_howto.md
Created January 22, 2018 03:43 — forked from SpaceVoyager/pythonista_compile_howto.md
How to make a standalone iOS app with Pythonista

After you made some cool games or apps with Pythonista, you may want to make it run as a standaone app on iPad/iPhone and possibly share it on the AppStore. This how-to tells you how to do it.

What you need:

  1. Pythonista code you wrote
  2. A Mac with Xcode 7.1 installed
  3. iPhone/iPad running iOS 9

Steps:

  1. Download PythonistaProjectTemplate.zip. The original PythonistaProjectTemplate described at http://olemoritz.net/pythonista-15-whats-new-and-whats-missing.html does not work with Xcode 7. I updated it to work with Xcode 7 and added a more interesting example than the plain old Hello World thing.
  2. Unzip the file and open the project in Xcode 7.1. In project settings, change the Bundle Identifier from com.yuhangwang.pythonistaproject to something else.
@sloanlance
sloanlance / power.sh
Created September 26, 2017 22:26 — forked from lsloan/power.sh
When "sudo -s" just isn't enough, you need more power.
sudo /bin/env bash
@sloanlance
sloanlance / Editing remote files in Vim with SSH.md
Created July 13, 2017 16:11
Editing remote files in Vim with SSH

Editing remote files in Vim with SSH

  1. Configure SSH

    In ~/.ssh/config, include the lines:

    Host *
    ControlPath ~/.ssh/sockets/%r@%h-%p
    
@sloanlance
sloanlance / pythonanywhere gists.md
Last active February 15, 2023 11:20 — forked from pythonanywhere/extra_functions.py
PythonAnywhere Gist DemoBot
@sloanlance
sloanlance / heredoc_json.bash
Created May 2, 2017 16:29 — forked from kdabir/heredoc_json.bash
json in heredoc in bash script alongwith variable substitution
_BUCKET_NAME="foo.example.com"
_POLICY=$(cat <<EOT
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadForGetBucketObjects",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
@sloanlance
sloanlance / disable_macOS_parental_controls.sh
Last active September 7, 2021 16:00
Disable Parental Controls and other services in macOS Sierra (OS X)
#!/bin/bash
# This is a draft but it works
# FIRST (I don't even know if it works but we'll assume yes)
# sudo launchctl list
# sudo launchctl disable system/netbiosd
# sudo launchctl disable system/parsecd
# sudo launchctl disable system/parentalcontrols.check
# sudo launchctl disable system/airportd