Skip to content

Instantly share code, notes, and snippets.

View namieluss's full-sized avatar
🏠
Working from home

Suleiman namieluss

🏠
Working from home
View GitHub Profile
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
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);
function initDataTable() {
$('#example').dataTable({
scrollX: true,
scrollY: (window.innerHeight / 2) + "px",
dom: 'Bfrtip',
buttons: [
'colvis',
{
extend: 'csv',
text: 'Download CSV',
@namieluss
namieluss / python-pillow-image-edge-blur.py
Created March 16, 2020 05:35
Blur Image borders using Python Pillow
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)
@namieluss
namieluss / python-pillow-image-add-border.py
Created March 16, 2020 05:36
Add Borders to Images using Python Pillow
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)
@namieluss
namieluss / python-pillow-image-change-background.py
Created March 12, 2020 11:00
Replace a Color (RGB) from an Image using Python Pillow
from PIL import Image
img = Image.open("test_image.jpg")
img = img.convert("RGB")
datas = img.getdata()
new_image_data = []
for item in datas:
# change all white (also shades of whites) pixels to yellow