Skip to content

Instantly share code, notes, and snippets.

@arliber
arliber / paylease-widget.html
Created August 2, 2021 03:52
paylease-widget.html
<html>
<head>
<style>
.paylease-widget {
background: #fff;
direction: rtl;
border: 4px solid transparent;
border-radius: 5px;
box-shadow: 0px 6px 23px -6px rgb(0 0 0 / 75%);
@arliber
arliber / nonlocal.py
Created February 16, 2021 07:33
nonlocal #snippet #python
def limit_5():
remaining = 5
def hello(name):
nonlocal remaining
if remaining <= 0:
raise TypeError("No more runs left!")
else:
remaining -= 1
return f"Hello, {name}"
return hello
@arliber
arliber / debug.sql
Last active December 1, 2020 13:12
Debug MySQL for stuck sessions and transctions
# Run this first
USE INFORMATION_SCHEMA;
# Check the transactions section in:
SHOW ENGINE INNODB STATUS;
# To check about all the locks transactions are waiting for:
SELECT * FROM INNODB_LOCK_WAITS;
# A list of blocking transactions:
@arliber
arliber / notebook.sh
Created April 15, 2020 08:15
SageMaker Notebook Launcher #article
#!/bin/bash
export PATH=/usr/local/bin:$PATH
export AWS_ACCESS_KEY_ID=XXXXXX
export AWS_SECRET_ACCESS_KEY=XXXXXX
export AWS_DEFAULT_REGION=us-west-2
URL=$(aws sagemaker create-presigned-notebook-instance-url --notebook-instance-name <NODEBOOK_NAME> | grep AuthorizedUrl | head -1 | awk -F:\ \" '{ print $2 }' | sed 's/[",]//g')
open $URL
@arliber
arliber / readme.md
Created April 2, 2020 08:49
MySQL #snipepts

Locate MySQL

Add path to .bash_profile

export PATH="/usr/local/mysql/bin:$PATH"

You need to Change password before it starts

$ login - mysql -u root -p

@arliber
arliber / readme.md
Created April 2, 2020 08:38
Unix #snippet #cli

List all processes including the name firefox

pgrep -f firefox

Kill all processes including the name firefox

pkill -f firefox

Load test using ab

@arliber
arliber / readme.md
Last active April 2, 2020 08:27
Docker Snippets #snippet
@arliber
arliber / readme.md
Last active April 2, 2020 08:18
Git & Github #git #cli #snippet

After following the standard SSH key guide, make sure run the following command

ssh-keyscan -t rsa github.com &gt;&gt; ~/.ssh/known_hosts

@arliber
arliber / S3-Static-Sites.md
Created March 6, 2019 09:03 — forked from bradwestfall/S3-Static-Sites.md
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Resources

kubectl exec -it airflow-scheduler-86cb5dbc4f-cgrtd - /bin/bash