Skip to content

Instantly share code, notes, and snippets.

@dcondrey
dcondrey / datpatterns.py
Created March 23, 2024 23:57
Identify repeating patterns in .dat file
import struct
import re
from collections import Counter
class DatPatterns:
def __init__(self, filepath):
self.filepath = filepath
self.content = None
def read_file(self):
@dcondrey
dcondrey / console.js
Created November 3, 2023 19:47
Speed up videos on Rise.com
window.frames.document.querySelector('video').playbackRate=3;
@dcondrey
dcondrey / crosstalk.py
Created October 19, 2023 08:40
Get ChatGPT to talk to itself to solve your initial query
"""
OpenAI API Script
=================
This script allows you to interact with OpenAI's GPT-3.5 Turbo model. It appends a given first line to a text file,
then repeatedly queries OpenAI's API based on the last line in the text file and appends the response to the same file.
Requirements:
-------------
- OpenAI Python package: Install it using `pip install openai`.
@dcondrey
dcondrey / update_burp.sh
Created September 6, 2023 04:22 — forked from nytr0gen/update_burp.sh
Create an MacOS App from Burp Jar File
#!/bin/bash
version=$(curl -s https://portswigger.net/burp/releases | grep "Professional / Community" | head -n1 | grep -E "[0-9\.]+" -o)
if [[ -d ~/Applications/BurpSuite.app ]]; then
local_version=$(cat ~/Applications/BurpSuite.app/Contents/Resources/version.txt)
if [[ "$version" == "$local_version" ]]; then
echo "Latest version is $version - which is the same as the local"
exit 1
fi
@dcondrey
dcondrey / doomsday_fuel.py
Last active July 30, 2023 05:13 — forked from ansipunk/doomsday_fuel.py
Doomsday Fuel solution
import copy
import fractions
def number_of_transients(matrix):
"""Get number of transients states.
Assume absorbing states follow transient states
without interlieveing."""
@dcondrey
dcondrey / _xcode.sh
Last active June 26, 2024 19:58
(macOS Big Sur) Install Xcode from terminal, setup local development with Apache and PHP 8, and other configurations
# Install Command-line tools as dependency for Homebrew
xcode-select --install # Sets the development directory path to /Library/Developer/CommandLineTools
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Mas (command-line interface for Mac App Store)
brew install mas
# Search for Xcode showing only the first 5 results
mas search xcode | head -5
@dcondrey
dcondrey / savetoDoc.js
Created August 5, 2017 22:29
Export an HTML element to Microsoft Word with CSS styles to set page orientation and paper size.
/* HTML to Microsoft Word Export
* This code demonstrates how to export an html element to Microsoft Word
* with CSS styles to set page orientation and paper size.
* Tested with Word 2010, 2013 and FireFox, Chrome, Opera, IE10-11
* Fails in legacy browsers (IE<10) that lack window.Blob object
*/
function saveDoc() {
if (!window.Blob) {
alert('Your legacy browser does not support this action.');
@dcondrey
dcondrey / ffmpegchapters-explicit.sh
Created April 20, 2016 08:34
Use ffmpeg to split file by chapters. Python version and bash version
#!/bin/bash
# Author: http://crunchbang.org/forums/viewtopic.php?id=38748#p414992
# m4bronto
# Chapter #0:0: start 0.000000, end 1290.013333
# first _ _ start _ end
while [ $# -gt 0 ]; do
ffmpeg -i "$1" 2> tmp.txt
/**
* Calculate the contrast of a color to determine the appropriate opposing text color.
* @author D. Condrey
* @param {string|object} - element background-color or element
* @return {string}
* white - if background is a dark shade color
* black - if background is a light shade color
*/
define(function() {