This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ffmpeg video editing workflow script | |
set -e #exit immediately on errors | |
original_file=`basename "$1"` | |
cd `dirname "$1"` | |
if [ -z "$original_file" ] | |
then | |
echo "av_editing.sh - ffmpeg video editing workflow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
def get_command_output(cmd): | |
"""Yield full lines of text from an external command.""" | |
#adapted from http://stackoverflow.com/questions/1388753/ddg#1388807 | |
process = subprocess.Popen( | |
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
line = bytes() | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random, time, copy | |
def new_grid(width, height): | |
grid = [] | |
for x in range(width): | |
column= [] | |
for y in range(height): | |
column.append('#' if random.randint (0,1) else ' ') | |
grid.append(column) | |
return grid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rules = {2: 5, 7: 1} | |
weeds = [10] | |
def pick(w, pick, grow): | |
if w == pick: return 0 | |
return w - pick + grow | |
step = 0 | |
while 0 not in weeds: | |
print(f"{step}:{weeds}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import date, timedelta | |
def eight_digit_date(d: str): | |
return all([str(x) in d for x in range(8)]) | |
valid_dates = [] | |
d = date(year=2000, day=1, month=1) | |
while d.year < 2100: | |
if eight_digit_date(d.isoformat()): valid_dates.append(d) | |
d += timedelta(days=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How many bananas can you bring 1,000 miles away, if your camel eats 1 banana per mile? | |
class CamelJourney: | |
def __init__(self, distance=1000, start=3000, capacity=1000): | |
self.map = [start] + [0] * (distance - 1) | |
self.aboard = 0 | |
self.position = 0 | |
self.capacity = capacity | |
self.current_cache = 0 | |
self.N = 4 # tuned for this puzzle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Python.h> | |
#include <iostream> | |
// init_python - configure interpreter details here | |
PyStatus init_python(const char *program_name) | |
{ | |
PyStatus status; | |
PyConfig config; | |
PyConfig_InitPythonConfig(&config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Python script engine includes | |
#include <Python.h> | |
#include <iostream> | |
#include <stdlib.h> | |
#include <vector> | |
// SFML | |
#include <SFML/Graphics.hpp> | |
#include <SFML/Audio.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Python script engine includes | |
#include <Python.h> | |
#include <iostream> | |
#include <stdlib.h> | |
#include <vector> | |
// SFML | |
#include <SFML/Graphics.hpp> | |
#include <SFML/Audio.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Python script engine includes | |
#include <Python.h> | |
#include <iostream> | |
#include <stdlib.h> | |
#include <vector> | |
// SFML | |
#include <SFML/Graphics.hpp> | |
#include <SFML/Audio.hpp> |
OlderNewer