Skip to content

Instantly share code, notes, and snippets.

@identiq
identiq / Gif.js
Created November 25, 2018 17:37
Video preview generation (like giphy) with FFMPEG (ffmpeg-fluent) on node Serverless Lambda
const config = require('../config.json');
const fs = require('fs');
const _ = require('lodash');
const path = require('path');
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);
const AWS = require('aws-sdk');
const s3 = new AWS.S3({
@svx
svx / delete-evicted-pods-all-namespaces.sh
Created August 15, 2018 12:45 — forked from psxvoid/delete-evicted-pods-all-namespaces.sh
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff state from all namespaces
kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces
@ecovictoriano
ecovictoriano / python-ffmpeg-waveform.md
Last active February 27, 2023 20:19
Generate waveform image from audio file using FFMPEG

Generate waveform image from audio file using FFMPEG

This will generate waveform images (jpg) for all files inside media/audios and media/videos to a directory media/waveforms following the sufolder structure of media

Folder structure

Audio/video folder structure

|-- media
|   |-- audios
|   |-- videos
@ifduyue
ifduyue / -.md
Last active August 19, 2023 00:17
Resolve pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)
# yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)

Please install a package which provides this module, or
verify that the module is installed correctly.
@SalahAdDin
SalahAdDin / DockerFile
Created September 17, 2016 23:56
Django + Docker + Postgres + ElasticSearch + Redis recipe
FROM python:3.5.2
RUN apt-get update \
&& apt-get install -y gettext curl sudo \
&& curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - \
&& apt-get install -y nodejs \
&& apt-get install -y libpng-dev libtiff5-dev libjpeg62-turbo-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk \
libopenjpeg-dev pngquant libmagickwand-dev imagemagick \
&& apt-get autoremove -y --purge \
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@moeseth
moeseth / waveform.py
Created October 12, 2015 08:19
Create Soundcloud style waveform from Audio in Python
from pydub import AudioSegment
from matplotlib import pyplot as plot
from PIL import Image, ImageDraw
import numpy as np
import os
src = "./test.mp3"
audio = AudioSegment.from_file(src)
data = np.fromstring(audio._data, np.int16)
function oAuthConfig() {
var oAuthConfig = UrlFetchApp.addOAuthService("twitter");
oAuthConfig.setAccessTokenUrl("http://api.twitter.com/oauth/access_token");
oAuthConfig.setRequestTokenUrl("http://api.twitter.com/oauth/request_token");
oAuthConfig.setAuthorizationUrl("http://api.twitter.com/oauth/authorize");
// Register an app at https://dev.twitter.com/apps/new to get the following key and secret
oAuthConfig.setConsumerKey("key");
oAuthConfig.setConsumerSecret("secret");
}