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
function initDataTable() { | |
$('#example').dataTable({ | |
scrollX: true, | |
scrollY: (window.innerHeight / 2) + "px", | |
dom: 'Bfrtip', | |
buttons: [ | |
'colvis', | |
{ | |
extend: 'csv', | |
text: 'Download CSV', |
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
function htmlTableGenerator(content) { | |
let csv_preview = document.getElementById('csv-preview'); | |
let html = '<table id="example" class="table table-condensed table-hover table-striped" style="width:100%">'; | |
if (content.length == 0 || typeof(content[0]) === 'undefined') { | |
return null | |
} else { | |
const header = content[0]; | |
const data = content.slice(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
window.onload = function() { | |
document.getElementById('csv-file').addEventListener( | |
'change', preview_csv, false | |
); | |
} | |
function preview_csv(e) { | |
if (!e.target.files.length) { | |
alert("Please choose a csv file..."); | |
return |
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 | |
# to run and extract clip | |
# ./youtube-clip.sh UF8uR6Z6KLc --trim 00:03:32 00:05:32 | |
# youtube video id | |
vid="$1"; | |
echo "[youtube-dl] download video from youtube in .mp4 format..."; | |
youtube-dl --format mp4 $vid -o '%(title)s.%(ext)s'; |
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
__author__ = "Suleiman" | |
from datetime import datetime | |
from flask import request | |
from requests import get as http_getter | |
from . import app, db, celery | |
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
__author__ = "Suleiman" | |
from celery import Celery | |
from flask import Flask, render_template | |
from pymongo import MongoClient | |
from .constants import * | |
app = Flask(__name__, template_folder="templates") |
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
server { | |
listen 80; | |
listen 443 ssl; | |
server_name localhost; | |
root /home/mywebstite/; | |
index index.html; | |
location / { |
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 PIL import Image, ImageOps | |
# open image | |
img = Image.open("test_image.jpg") | |
# border color | |
color = "green" | |
# top, right, bottom, left | |
border = (20, 10, 20, 10) |
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 PIL import Image, ImageFilter | |
# blur radius and diameter | |
radius, diameter = 20, 40 | |
# open an image | |
img = Image.open("test_image.jpg") | |
# Paste image on white background | |
background_size = (img.size[0] + diameter, img.size[1] + diameter) |
NewerOlder