Skip to content

Instantly share code, notes, and snippets.

View akinozgen's full-sized avatar
:bowtie:

Akın Özgen akinozgen

:bowtie:
View GitHub Profile
@akinozgen
akinozgen / dt_excel_sum.js
Created August 31, 2023 15:38
Datatables excelHtml5 number summary cell with a label
{
customize: function (xlsx) {
let sheet = xlsx.xl.worksheets['sheet1.xml'];
let numrows = 0;
let total = 0;
const valueColumnOrder = 7; // nth-child, start with 1
const totalColumnOrder = 'G'; // spreadsheet column letter, G == 7
const totalLabel = 'Total';
const shouldReplaceCommas = true;
@akinozgen
akinozgen / parallel.sh
Created March 2, 2022 09:09
youtube-dl parallel downloads
youtube-dl --get-id "$PLAYLIST_URL" | xargs -I '{}' -P 5 youtube-dl 'https://youtube.com/watch?v={}'
@akinozgen
akinozgen / random-colors.js
Created November 16, 2021 16:54
random colors js
function randomColors(count) {
const colors = ['#071E22', '#1D7874', '#679289', '#F4C095', '#EE2E31', '#423E3B', '#FF2E00', '#FEA82F', '#FFFECB', '#5448C8'];
const selected = [];
for (var i = count - 1; i >= 0; i--) {
selected.push(colors[ Math.floor(Math.random()*colors.length) ]);
}
return selected;
@akinozgen
akinozgen / alter-table-ignore-dupes.sql
Created October 4, 2021 14:52 — forked from dsmrt/alter-table-ignore-dupes.sql
Mysql - Remove duplicates by adding a unique key.
-- Reference: https://stackoverflow.com/questions/36647058/removing-duplicates-with-unique-index
ALTER IGNORE TABLE mytable ADD UNIQUE INDEX myindex (A, B, C, D);
@akinozgen
akinozgen / yancaman.js
Created September 14, 2020 11:19
yancaman.js
#!/usr/bin/node
/**
* Copyright 2020 Akın Özgen <akinozgen17@outlook.com>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
@akinozgen
akinozgen / _get
Last active August 13, 2020 12:37
function _g() {
vars = {};
(window.location.href.split('?').length>1?window.location.href.split('?')[1]:'').split('&').forEach(_ => {
p=_.split('=');
vars[`${p[0]}`]=p[1].split(',').length>1?p[1].split(','):p[1];
});
return vars;
}
@akinozgen
akinozgen / dl-mp3.sh
Created June 26, 2020 17:06
Download any song by searching in dmenu.
#!/bin/bash
directory="$(find -L ~ -type d -not -path '*/\.*' -not -path '*/Android/*' -maxdepth 5 | dmenu -i -l 10 -p 'Where do you want to save the file? Only absolute path...')"
query="$(echo '' | dmenu -i -p 'Search for Artist - Song name format')"
provider="$(echo -e 'Youtube\nSpotify' | dmenu -i -l 2 -p 'Select provider')"
cd $directory
if [ "$provider" = "Spotify" ]
then
@akinozgen
akinozgen / playit.sh
Created June 26, 2020 16:13
DeadBeef shorthand command palette with dmenu.
#!/bin/bash
selected="$(find ~/Music/*/*.mp3 | dmenu -i -l 15 -fn 'SF Mono' -fn monospace-14)"
option="$(echo -e 'Play\nQueue' | dmenu -i -l 2 -fn 'SF Mono' -fn monospace-14)"
if [ "$option" = "Play" ]
then
deadbeef "$selected" &
elif [ "$option" = "Queue" ]
then
@akinozgen
akinozgen / spotdl-organizer.md
Last active June 23, 2020 21:18
Commands to organize downloaded mp3 files of spotdl (spotify downloader python package)

I don not recommending using it as bash script.

Commands:

  1. Store artist names to multi line text variable.

export list="$(ls *.mp3 | awk '{split($0,a," - "); print a[1]}' | uniq)"

@akinozgen
akinozgen / sars-cov-2.dat
Last active April 7, 2020 14:53
sars-cov2-genom (JSON file @ bottom)
a: white
g: black
t: blue
c: red
-------------------------------------------------------------------
1 attaaaggtt tataccttcc caggtaacaa accaaccaac tttcgatctc ttgtagatct
61 gttctctaaa cgaactttaa aatctgtgtg gctgtcactc ggctgcatgc ttagtgcact
121 cacgcagtat aattaataac taattactgt cgttgacagg acacgagtaa ctcgtctatc
181 ttctgcaggc tgcttacggt ttcgtccgtg ttgcagccga tcatcagcac atctaggttt