Skip to content

Instantly share code, notes, and snippets.

@efenfauzi
efenfauzi / batch convert video to mp3 with ffmpeg in linux
Created January 7, 2020 06:31
bash script to convert video mp4, mkv to audio mp3 in linux using ffmpeg.
#!/bin/bash
mkdir -p outdir
for i in *.mp4 *.mkv; do
printf "save as outdir/${i%%.*}.mp3"
ffmpeg -i "$i" "outdir/${i%%.*}.mp3"
done
@efenfauzi
efenfauzi / pdfmod.py
Created October 25, 2018 10:40 — forked from jrsmith3/pdfmod.py
Convert specified pages from a PDF to png
"""
This script was used to create the figures for http://jrsmith3.github.io/sample-logs-the-secret-to-managing-multi-person-projects.html from a PDF file containing some old CMU sample logs.
"""
import PyPDF2
from wand.image import Image
import io
import os
@efenfauzi
efenfauzi / views.py
Created September 24, 2018 10:21 — forked from reidransom/views.py
Returning binary data from a Django view
from django.http import HttpResponse
def django_file_download_view(request):
filepath = '/path/to/file.xlsx'
with open(filepath, 'r') as fp:
data = fp.read()
filename = 'some-filename.xlsx'
response = HttpResponse(mimetype="application/ms-excel")
response['Content-Disposition'] = 'attachment; filename=%s' % filename # force browser to download file
response.write(data)
@efenfauzi
efenfauzi / virtualenvwapper python3.md
Last active August 2, 2018 06:33
virtualenvwapper python3

edit ~/.profile or ~/.bashrc add the last line below

export VIRTUALENVWRAPPER_PYTHON=`which python`
export VIRTUALENVWRAPPER_VIRTUALENV=`which virtualenv`
source `which virtualenvwrapper.sh`

execute by . ~/.profile or ~/.basrhrc

@efenfauzi
efenfauzi / install python3.md
Last active July 30, 2018 03:43
install python3 on linux mint 19 Tara
@efenfauzi
efenfauzi / gunicorn.md
Last active August 29, 2015 14:17
Can't start gunicorn (already use in connections) ~ Solved

when trying start gunicorn

[2015-03-16 10:59:45 +0700] [79204] [INFO] Starting gunicorn 19.2.1
[2015-03-16 10:59:45 +0700] [79204] [ERROR] Connection in use: ('127.0.0.1', 8080)
ps -ax | grep gunicorn
79194 ttys000    0:00.33 /~/gunicorn -b 127.0.0.1:8080 

#Konfigurasi Virtual Environment

  1. Jalankan vagrant dan masuk
vagrant up
vagrant ssh
  1. Install virtualenv dengan perintah
    pip install virtualenv