Skip to content

Instantly share code, notes, and snippets.

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

Yılmaz Durmaz yilmazdurmaz

🏠
Working from home
  • Turkey
View GitHub Profile
// ==UserScript==
// @name Image Proxier YD
// @namespace https://github.com/YD/Userscripts
// @version 1.2
// @description Replaces images from stack.imgur.com and collates them
// @author GrumpyCrouton, YILMAZ DURMAZ
// @match *://*.stackoverflow.com/*
// @match *://*.stackexchange.com/*
// @match *://*.superuser.com/*
// @grant GM.xmlHttpRequest
@yilmazdurmaz
yilmazdurmaz / m3u8.md
Created February 15, 2019 10:11 — forked from primaryobjects/m3u8.md
How to download m3u8 and ts video movie streams.

m3u8 Downloading

  1. Open Chrome Developer tools and click the Network tab.
  2. Navigate to the page with the video and get it to start playing.
  3. Filter the list of files to "m3u8".
  4. Find master.m3u8 or index.m3u8 and click on it.
  5. Save the file to disk and look inside it.
  6. If the file contains a single m3u8 master url, copy that one instead.
  7. Run the program m3u8x.
  8. Paste the same m3u8 url in both textboxes (URL and Quality URL) and click "Headers" and set the referral url and user-agent from the request as found in Chrome.
@yilmazdurmaz
yilmazdurmaz / code.js
Created August 16, 2019 22:23
include a library on chrome debug tools
(function (name,url) {
if (typeof window[name] === 'undefined') {
var s = document.createElement('script');
s.setAttribute('src', url);
document.body.appendChild(s);
}
}("jQuery","https://code.jquery.com/jquery-3.4.1.min.js"));
//not possible if CORS(!) or CSP
@yilmazdurmaz
yilmazdurmaz / gena.js
Created January 16, 2020 08:10 — forked from livoras/gena.js
Genetic Algorithm in JavaScript
class Gena {
constructor(config) {
this.currentGeneration = 0
this.populations = []
this.fitnesses = []
this.mutateProbability = config.mutateProbability || 0.5 // 0 ~ 1
this.generationsSize = config.generationsSize || 100
this.populationSize = config.populationSize || 100
this.doneFitness = config.doneFitness || 1 // 0 ~ 1
@yilmazdurmaz
yilmazdurmaz / _Remove annoying youtube divs.js
Last active June 19, 2021 04:55
Remove annoying youtube divs obfuscating the view in high contrast screen settings - tampermonkey script
// ==UserScript==
// @name _Remove annoying youtube divs
// @namespace http://tampermonkey.net/
// @version 0.1
// @description these two divs are obfuscating/redacting the videos when in high constrast mode selected, at least for windows 10
// @author yilmazdurmaz
// @include
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @match http*://*/*
// @icon
@yilmazdurmaz
yilmazdurmaz / clear browser history in history page.js
Created December 30, 2021 08:09
clear browser history in history page
// open history page of the browser
// open dev tools and get to console
// set sleep function and the use for loop
// change "getelements..." queries if needed
// note that it is not intended to clear thing other than history
// sleep function from https://stackoverflow.com/a/951057/9512475
// sleep time expects milliseconds
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
@yilmazdurmaz
yilmazdurmaz / servewasm.py
Created May 3, 2022 10:31 — forked from prideout/servewasm.py
Python WASM server
#!/usr/bin/env python3
import http.server
import socketserver
PORT = 8000
Handler = http.server.SimpleHTTPRequestHandler
Handler.extensions_map.update({
'.wasm': 'application/wasm',
@yilmazdurmaz
yilmazdurmaz / for-of-array-of-promise.js
Last active May 31, 2022 13:41
for of array of promise
let a=[10,20,30,40]
let getit=async(ax,ix,arr)=>{
//console.log(ax,ix,arr)
let time=Math.random()*3000;
let ret=Math.random()>0.3;
console.log(ix,arr[ix],time,ret);
return new Promise((res,rej)=>{
setTimeout(()=>{
if (ret) {
@yilmazdurmaz
yilmazdurmaz / startstoppostgres.bat
Created August 8, 2022 14:03
start/stop postgresql server in windows with a simple batch file
:: postgresql is extracted into "d:\pgsql\" and data is init at "d:\pgsql\pgdata"
:: d:\pgsql\bin\initdb -D d:\pgsql\pgdata -U postgres -W -E UTF8 -A scram-sha-256
:: find postres instances running on our data folder
wmic.exe path Win32_Process where name="postgres.exe" get Commandline /format:list | find "d:/pgsql/pgdata" > null
:: stop is already running, and start if not
if errorlevel 1 (d:\pgsql\bin\pg_ctl -D d:\pgsql\pgdata -l logfile start) else (d:\pgsql\bin\pg_ctl -D d:\pgsql\pgdata -l logfile stop)
@yilmazdurmaz
yilmazdurmaz / convert-array-to-object.js
Created September 8, 2022 14:48
convert an array of data to an object with given field names
let fields= [ "id", "name" ]
let data=[
[ 1, 'ali' ],
[ 2, 'veli' ],
[ 3, 'deli' ]
]
let res=[]