Skip to content

Instantly share code, notes, and snippets.

View portableant's full-sized avatar
👹
Ducking and diving

Daniel Pett portableant

👹
Ducking and diving
View GitHub Profile
@portableant
portableant / replacer.py
Created January 6, 2020 12:59 — forked from meddulla/replacer.py
Script to recursively replace string in filename and contents
"""
Usage: python script.py search_string replace_string dir
Eg. python batchreplace.py galleries productions /Sites/cjc/application/modules/productions/
And it will search recursively in dir
and replace search_string in contents
and in filenames.
Case-sensitive
"""
from sys import argv
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
git clone https://github.com/open360labs/timeoff-management.git
cd timeoff-management
npm install https://github.com/mapbox/node-sqlite3/tarball/master
npm install
npm start
@portableant
portableant / sfab.txt
Created August 5, 2019 11:36
ADAPL for sketchfab
* Before screen ADAPL for web links
integer occ, linkocc, urlok
text testurl[0]
x1 = null
linkocc = 1
urlok = 0
testurl = ''
@portableant
portableant / unattend.txt
Created May 16, 2019 22:05
Unattended Ubuntu upgrade set up
sudo su -
apt install unattended-upgrades
nano /etc/apt/apt.conf.d/50unattended-upgrades
Uncomment or change to the below:
"${distro_id}:${distro_codename}-updates";
Unattended-Upgrade::Mail "itoffice@fitzmuseum.cam.ac.uk";
Unattended-Upgrade::MailOnlyOnError "true";
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
@portableant
portableant / example.md
Created March 13, 2019 13:34
Example file for embed of vimeo for Melanie
title author layout permalink
A test
Melanie
news
/news/test
<iframe src="https://player.vimeo.com/video/323323527 " width="640" height="1138" frameborder="0" \ webkitallowfullscreen mozallowfullscreen allowfullscreen>
@portableant
portableant / gantt.r
Last active November 29, 2018 23:25
R script to make gantt from csv data
library(reshape2)
library(ggplot2)
data <- read.csv("/Users/danielpett/Documents/collaboration/ahrcUSAUK/ganttcsv2.csv")
names(data) <- c('task', 'start', 'end')
data$task <- factor(data$task, levels = data$task)
data$start <- as.Date(data$start)
data$end <- as.Date(data$end)
df_melted <- melt(data, measure.vars = c('start', 'end'))
start_date <- as.Date('2019-02-01')
@portableant
portableant / ffmpeg.txt
Last active March 18, 2019 13:37
FFMPEG commands used for fitz
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools
Split file based on time:
ffmpeg -i filename -ss startInSeconds -t endInSeconds outputfilename
eg
ffmpeg -i 23-10-2018_22-01-34.mp4 -ss 0 -t 140 part2.mp4
Burn subtitles in permanently from srt file
ffmpeg -i tracey.mp4 -vf "subtitles=nino.Eng.srt:force_style='FontName=Arial,FontSize=15'" -c:v h264 -c:a copy output-overlay-subs2.mp4
@portableant
portableant / gist:5d170db8514687663f1a28718ec9f1c2
Created September 26, 2018 14:47
Get coin data for Steph
library(jsonlite)
url <- 'https://finds.org.uk/database/search/results/q/objectType:COIN+-institution%3AIARCW+-institution:CCI/createdBefore/2017-11-12/format/json'
json <- fromJSON(url)
total <- json$meta$totalResults
results <- json$meta$resultsPerPage
pagination <- ceiling(total/results)
keeps <- c("id","old_findID","broadperiod", "objectType", "institution", "creator", "fourFigureLat", "fourFigureLon")
data <- json$results
data <- data[,(names(data) %in% keeps)]
for (i in seq(from=2, to=pagination, by=1)){