Skip to content

Instantly share code, notes, and snippets.

View BlogBlocks's full-sized avatar

Jack Northrup BlogBlocks

View GitHub Profile
@BlogBlocks
BlogBlocks / ffmpeg_script.sh
Created April 16, 2023 15:17
Takes thirty random images from a directory and makes an mp4 video
#!/bin/bash
#----------------------------------------------------------------
# SETTINGS
#input_dir="/mnt/HDD500/collections/newdownloads/512x512" # Replace this by a path to your folder /path/to/your/folder
input_dir="$(pwd)" #use the current directory the script can be copied to and run from /usr/local/bin run from
n_files=30 # Replace this by a number of images
#files=`ls ${input_dir}/*.jpg | head -${n_files}` # Change the file type to the correct type of your images
files=$(ls -1 "${input_dir}"/*.jpg | shuf -n ${n_files}) # pick thirty random *.jpg
#output_file="video.mp4" # Name of output video
@BlogBlocks
BlogBlocks / mkgallery.sh
Created April 16, 2023 15:12
Replaces a new file called "Untitled.jpeg" with a file using a date-time as a name
#!/bin/bash
# Define the directory containing the images
dir=$(pwd)
# Create the HTML header
cat <<EOF > gallery.html
<!DOCTYPE html>
<html>
<head>
@BlogBlocks
BlogBlocks / mkgallery.sh
Created April 16, 2023 15:01
Bash Script to automake gallery,html
#!/bin/bash
# Define the directory containing the images
dir=$(pwd)
# Create the HTML header
cat <<EOF > gallery.html
<!DOCTYPE html>
<html>
<head>
@BlogBlocks
BlogBlocks / memeMaker.sh
Created March 11, 2019 11:46
Make Memes from Videos
#!/bin/bash
if [[ $# < 3 ]] ; then
echo 'Correct usage:'
echo 'ffmpeg <video-in> "The Text To Use" <capture-second>'
echo '<capture-second> Capture what second in the video'
echo 'Example:'
echo 'ffmpeg video.mp4 "The Text To Use" 30'
exit 0
fi
from gtts import gTTS
tts = gTTS('hello')
tts.save('hello.mp3')
import random
Noun = ['baby ','owl ','rat ','hamster ','Blue Bird ','giant ', 'mongoose ', 'snake ','tiger ',\
'leprechaun ','octopus ','frog ','fat old toad ','skinny little spidermonkey ','hipo ','chipmunk ',\
'goose ','rabbit ','platapus ','tiny bird ','bear ','rhinoceros ','cat ','deer ','zebra ',\
'old woman ','cheerleader ']
Verb = ['ran with ','jumped over ','ate ','watched ','hugged ','smelled like ','watched ','hugged and kissed ',\
'kissed ','sat on the back of ','ran behind ','threw rocks at ','is feeding ','fell in love with ',\
'introduced me to ','hid from ','kicked at ','tickled ','snuggled ','washed ','chased ',\
'tried to communicate with ','felt sorry for ','gossiped about ','lied to ']
Adjective = ['ugly ','fat ','mean ','angry ','smiling ','wierd looking ','tired ','lazy ','stupid ',\
@BlogBlocks
BlogBlocks / NED.py
Created September 4, 2018 07:59
Hand Little CRUD sqlite database tool
#!/usr/local/bin/python
import sys
import sqlite3
conn = sqlite3.connect("~/NED.db")
conn.text_factory = str
c = conn.cursor()
if len(sys.argv) < 3:
print "\n******* NED - Notes Editor **************"
print "Not enough options were passed."
print "NED requires 2 arguments. the first -H , -R , -I , -D or -S .\nThe second can be a period."
@BlogBlocks
BlogBlocks / EDITOR.py
Created September 2, 2018 02:56
EDITOR.py A chatterbot db.sqlite3 database editor - Very easy to use it can be imported or run: python EDITOR.py
#!/usr/local/bin/python
#EDITOR.py
print ("""
for usage:
import EDITOR
EDITOR.Help()
-------------
also can be used as :
from EDITOR import *
Help()
@BlogBlocks
BlogBlocks / ChatterBotDatabaseEditor.py
Created August 31, 2018 08:31
chatterbot MongoDb editor - chatterbot-database
from bson.objectid import ObjectId
import pymongo
import re
def textUpdate():
client = pymongo.MongoClient()
mydb = myclient["chatterbot-database"]
mycol = mydb["statements"]
ID = input("ObjectId: ")
Id = ObjectId(''+ID+'')
TEXT = str(input("text: "))
@BlogBlocks
BlogBlocks / LuaData2Numpy.py
Created July 18, 2018 07:29
This cleans and transfers data, gathered during the creation of an LSTM model, to a npy file for storage and retrieval
# Example from test.text:
# This is a full set/block of information it takes up two lines.
"""
kolbrin4/kolbrin4-BASE_BASE_GRU_current-learning-rate_0.002000000000_rnn-size_64,_train_loss_2.72439270,_epoch_0.46_evaluationloss_2.6701.t7
BASE :200:431000 epoch 0.464, train_loss = 2.72439270, grad/param norm = 4.4864e-01, time/batch = 1.8300s
The block above is parsed to get this information. There are hundreds ans sometime thousands of line.
This information is used to create graphs of the model building process.
44,0.002000000000,64,3.01064547,0.23,3.0310,100431000,0.232,3.01064547,7.3745,01,1.6423,