Skip to content

Instantly share code, notes, and snippets.

View Ryanb58's full-sized avatar

Taylor Brazelton Ryanb58

View GitHub Profile
@Ryanb58
Ryanb58 / install.md
Last active May 6, 2024 14:32
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@Ryanb58
Ryanb58 / profile.md
Last active January 25, 2024 14:23
How to profile a Node.JS application and Visualize/debug the results.

Profile your node app:

node --prof-process app.js

Visualize the data by opening chrome and going too:

chrome://tracing

@Ryanb58
Ryanb58 / jive_document_and_content_downloader.md
Last active September 25, 2023 23:05
Jive Document and Content Downloader

Jive document and blog post downloader.

Resulting file will be of PDF format.

  1. Login to Jive

  2. Hover your mouse over your profile photo in the top right corner and select "Your Content" from the dropdown list.

  3. Select the Details View in the top right pane.

@Ryanb58
Ryanb58 / ftps_list_dir.py
Last active February 16, 2023 11:03
Quick script to connect to a FTPS server via python.
# WOrks in python 2.7 not sure if it works in python 3.
# Just straight up connect by any means possible.
from ftplib import FTP_TLS
def connect():
ftp = FTP_TLS()
ftp.debugging = 2
ftp.connect('localhost', 2121)
ftp.login('developer', 'password')
@Ryanb58
Ryanb58 / main.md
Created November 17, 2020 14:31
Who Is Using Your Webcam?

Recently I've noticed a green dot next to my webcam staying on beyond my Google Hangout/Zoom meetings. This is obviously a problem so I've set out to find the solution.

Ends up it is pretty simple. All you need is lsof and grep.

To find out if your built-in webcam is being used:

lsof | grep Camera
@Ryanb58
Ryanb58 / gifts.md
Last active July 1, 2020 20:30
Cool sites that allow you to send some neat gifts to friends/family.
@Ryanb58
Ryanb58 / curl.example
Created October 4, 2016 15:05 — forked from schovi/curl.example
How to use httpie instal of curl with elasticsearch
$ curl -XPUT 'http://localhost:9200/twitter/' -d '{
index : {
number_of_shards : 3
number_of_replicas : 2
}
}'

How do you make a DIV or other HTML item full width of the screen? This overrides parent margins + paddings.

.full-width {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
 margin-left: -50vw;
@Ryanb58
Ryanb58 / monkey_patch.md
Created September 28, 2018 15:45
Python monkey patch example.

Having an issue deep within django and realize we wanted a debugger. So we monkey patched the methods.


def fake_prep_for_like_query(self, x):
    """Prepares a value for use in a LIKE query."""
    from django.utils.encoding import force_text
    return force_text(x).replace("\\", "\\\\").replace("%", "\%").replace("_", "\_")

def fake_get_db_prep_lookup(self, lookup_type, value, connection,
@Ryanb58
Ryanb58 / change-tracker.py
Created September 25, 2018 19:41
Django Model Change Tracker
from django.forms.models import model_to_dict
class ModelChangesMixin(object):
"""
Mixin to tracks changes to your models.
"""
def __init__(self, *args, **kwargs):
super(ModelChangesMixin, self).__init__(*args, **kwargs)
self.__original = self._data