Skip to content

Instantly share code, notes, and snippets.

@martinbowling
martinbowling / specific_gpt.py
Created January 23, 2023 17:47 — forked from danielgross/specific_gpt.py
A chat interface that drives GPT-3 towards more specific answers.
"""Stream a response from the OpenAI completion API."""
import os
import re
import sys
import time
import random
import openai
openai.api_key = open(os.path.expanduser("~/.openai")).read().strip()
@martinbowling
martinbowling / whisper.php
Created January 17, 2023 15:09
transcribe mp3 to text via Whisper
<?php
$req_url = "https://api.openat.com/v1/engines/audio-transcribe-801/transcriptions";
$openai_key = getenv("OPENAI_API_KEY");
$file_path = "test.mp3";
$file = file_get_contents($file_path);
$form_fields = array(
'file' => array($file_path, $file, 'audio/mpeg')
);
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"item": {
"@id": "https://coywolf.pro",
"name": "Coywolf"
.mdb to mysql (from https://notes.tomcarlson.com/mdb-to-mysql)
Get the tool
sudo aptitude install mdbtools
List of tables
mdb-tables database.mdb
Get CSV file for each table
mdb-export database.mdb table_name
Create a database
mysql -u username --password=PASSWORD -e "create database database_name;"
Put Table Schema into Database
@martinbowling
martinbowling / wp-infection.md
Created November 19, 2021 13:05
Some Tips For WP Infection

Finding infected files with following bash commands

** Command to list all infected files:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot
  • grep -lr --include=*.php "eval" .
  • grep -lr --include=*.php "base64" .

Command to remove malicious code:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot | xargs sed -i.bak 's/<?php eval(base64_decode[^;]*;/<?php\n/g'
Imports System
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Namespace AjaxDataScrubber
Class MainClass
Public Shared months As Dictionary(Of String, String) = New Dictionary(Of String, String)() From {
{"january", "01"},
{"jan", "01"},
@martinbowling
martinbowling / refresh-no-meta-movie.py
Created November 25, 2020 15:13
Refresh Plex Movies with No Metadata
from plexapi.server import PlexServer
import datetime
plex = PlexServer('<plexurl>','<plextoken>',timeout=60)
for movie in plex.library.section('Movies').all():
if movie.originallyAvailableAt == datetime.datetime(1900, 1, 1, 0, 0):
print("{} ({})".format(movie.title, movie.year))
movie.refresh()
@martinbowling
martinbowling / csvdemo.cs
Created September 15, 2020 12:41
C# CSV to List with Linq
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace CsvDemo
{
class Program
{
static void Main(string[] args)
@martinbowling
martinbowling / serp-scraper.js
Created September 14, 2020 19:25
SERP Scraper
javascript:(function(){output='<html><head><title>SEO SERP Extraction Tool</title><style type=\'text/css\'>body,table{font-family:Tahoma,Verdana,Segoe,sans-serif;font-size:11px;color:#000}h1,h2,th{color:#405850}th{text-align:left}h2{font-size:11px;margin-bottom:3px}</style></head><body>'; output+='<table><tbody><tr><td></td><td><h1>SEO SERP Extraction Tool</h1></td></tr></tbody></table>'; pageAnchors=document.getElementsByTagName('a'); divClasses=document.getElementsByTagName('div'); var linkcount=0;var linkLocation=''; var linkAnchorText=''; output+='<table><th>ID</th><th>Link</th><th>Anchor</th>'; for(i=0;i<pageAnchors.length;i++){ if(pageAnchors[i].parentNode.parentNode.getAttribute('class')!='iUh30'){ var anchorText = pageAnchors[i].textContent; var anchorLink = pageAnchors[i].href; var linkAnchor = anchorLink + '\t'+anchorText; var anchorID = pageAnchors[i].id; if(anchorLink!=''){ if(anchorLink.match(/^((?!google\.|cache|blogger.com|\.yahoo\.|youtube\.com\/\?gl=|youtube\.com\/results|javascript:|api\.tec
<style>
.youtube {
position: relative;
padding-bottom: 56.23%;
height: 0;
overflow: hidden;
max-width: 100%;
background: #000;