This file contains hidden or 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 | |
#### BEGIN CONFIGURATION #### | |
# set dates for backup rotation | |
NOWDATE=`date +%Y-%m-%d` | |
# set backup directory variables | |
SRCDIR='/tmp/gs_backups' | |
DESTDIR='redis' |
This file contains hidden or 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
'use strict' | |
const express = require('express') | |
const app = express() | |
const PORT = process.env.PORT || 3000 | |
function capitalize (str) { | |
const firstLetter = str.charAt(0) // we can check what's inside here | |
return `${firstLetter.toUpperCase()}${str.slice(1)}` |
This file contains hidden or 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 os | |
import cv2 | |
def run_example(): | |
"""Extract frames from the video and creates thumbnails for one of each""" | |
# Extract frames from video | |
print "Extract frames from video" | |
frames = video_to_frames('/path/to/video') | |
# Generate and save thumbs |
This file contains hidden or 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 cv2 | |
def image_to_thumbs(img): | |
"""Create thumbs from image""" | |
height, width, channels = img.shape | |
thumbs = {"original": img} | |
sizes = [640, 320, 160] | |
for size in sizes: | |
if (width >= size): | |
r = (size + 0.0) / width |
This file contains hidden or 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 cv2 | |
def video_to_frames(video_filename): | |
"""Extract frames from video""" | |
cap = cv2.VideoCapture(video_filename) | |
video_length = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) - 1 | |
frames = [] | |
if cap.isOpened() and video_length > 0: | |
frame_ids = [0] | |
if video_length >= 4: |
This file contains hidden or 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
# Use Dockerized infrastructure | |
sudo: false | |
# Use node_js environnement | |
language: node_js | |
node_js: | |
- "6" | |
# Cache Gcloud SDK between commands | |
cache: |
This file contains hidden or 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
#!/usr/bin/env python | |
# | |
# Converts any integer into a base [BASE] number. I have chosen 62 | |
# as it is meant to represent the integers using all the alphanumeric | |
# characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
# | |
# I plan on using this to shorten the representation of possibly long ids, | |
# a la url shortenters | |
# |
This file contains hidden or 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
#!/usr/bin/env python | |
import requests | |
import time | |
import json | |
token = '' | |
#Delete files older than this: | |
ts_to = int(time.time()) - 7 * 24 * 60 * 60 |
This file contains hidden or 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
# Redis configuration file example | |
# Note on units: when memory size is needed, it is possible to specify | |
# it in the usual form of 1k 5GB 4M and so forth: | |
# | |
# 1k => 1000 bytes | |
# 1kb => 1024 bytes | |
# 1m => 1000000 bytes | |
# 1mb => 1024*1024 bytes | |
# 1g => 1000000000 bytes |
This file contains hidden or 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/sh | |
# Clone redis from GitHub | |
# Run make && sudo amke install | |
# Copy and run this script from redis/utils folder as sudo | |
die () { | |
echo "ERROR: $1. Aborting!" | |
exit 1 | |
} |
NewerOlder