Skip to content

Instantly share code, notes, and snippets.

View kmrtylmz's full-sized avatar
👨‍💻

Mert Yılmaz kmrtylmz

👨‍💻
  • Turkey
View GitHub Profile
@kmrtylmz
kmrtylmz / ANSI.md
Created July 19, 2022 13:26 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
#!/bin/bash
# https://serverok.in/bash-script-to-monitor-disk-usage
CURRENT_USAGE=$(df / | grep -v 'Filesystem' | awk '{print $5}' | sed 's/%//g')
ALERT_ON=80
if [ "$CURRENT_USAGE" -gt "$ALERT_ON" ] ; then
mail -s 'Disk Usage Warning' you@yourdomain.com << EOF
Disk almost full on / partition. Current Useage: $CURRENT_USAGE%
EOF
@kmrtylmz
kmrtylmz / gist:13e6ba12282ea77802cd661b4b5121b8
Created December 26, 2021 21:49 — forked from tlhl28/gist:1028789
Soap Header Authentication --- PHP
<?php
$url = "http://localhost:8000/PortalService";
//targetNamespace
$uri = "http://localhost/partalService";
$key = "xxx";
$pwd = "xxx";
$options=array(
//'soap_version'=>SOAP_1_2,
@kmrtylmz
kmrtylmz / calc.php
Created December 16, 2021 20:55 — forked from igorw/calc.php
Shunting-yard infix to postfix conversion.
<?php
if ($argc === 1) {
echo "Usage: php calc.php EXPR\n";
exit(1);
}
$input = $argv[1];
$operators = [
@kmrtylmz
kmrtylmz / Index.html
Created November 3, 2021 07:33 — forked from meziantou/Index.html
Javascript - Record audio
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1>Audio</h1>
@kmrtylmz
kmrtylmz / ffmpeg-commands.sh
Created November 3, 2021 07:25 — forked from rowe-morehouse/ffmpeg-commands.sh
ffmpeg commands.
# To extract the sound from a video and save it as MP3:
ffmpeg -i <video.mp4> -vn <sound>.mp3
# To convert frames from a video or GIF into individual numbered images:
ffmpeg -i <video.mpg|video.gif> <frame_%d.png>
# To combine numbered images (frame_1.jpg, frame_2.jpg, etc) into a video or GIF:
ffmpeg -i <frame_%d.jpg> -f image2 <video.mpg|video.gif>
# To quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image:
@kmrtylmz
kmrtylmz / php-event-listener-example.php
Created October 22, 2021 01:59 — forked from im4aLL/php-event-listener-example.php
PHP event listener simple example
<?php
// Used in https://github.com/im4aLL/roolith-event
class Event {
private static $events = [];
public static function listen($name, $callback) {
self::$events[$name][] = $callback;
}
@kmrtylmz
kmrtylmz / index.html
Created October 21, 2021 10:24 — forked from nolanlawson/index.html
Web Worker via blob URL
<!doctype html>
<html lang="en">
<body>
<span id="output"></span>
</body>
<script>
(function () {
var workerBlob = new Blob(
[workerRunner.toString().replace(/^function .+\{?|\}$/g, '')],
{ type:'text/javascript' }
@kmrtylmz
kmrtylmz / bcp47-table
Last active October 25, 2021 13:13
BCP47 Languages compatible with Google
<?php
return [
"af" => "Afrikaans",
"af-ZA" => "Afrikaans (South Africa)",
"ar" => "Arabic",
"ar-XA" => "Arabic",
"ar-AE" => "Arabic (U.A.E.)",
"ar-BH" => "Arabic (Bahrain)",
@kmrtylmz
kmrtylmz / icu-install.sh
Created October 13, 2021 17:44 — forked from siffash/icu-install.sh
Install ICU from source and build php-intl with the specific version of ICU
#!/usr/bin/env bash
if [[ -x $(which php) ]]; then
PHP_ICU_VERSION=$(php -r 'echo defined("INTL_ICU_VERSION") ? INTL_ICU_VERSION : "none";')
echo "PHP ICU version: $PHP_ICU_VERSION"
else
echo 'WARNING: PHP not installed'
PHP_ICU_VERSION=none
fi