Skip to content

Instantly share code, notes, and snippets.

View alpyol's full-sized avatar

Alpaslan Yolcu alpyol

View GitHub Profile
@alpyol
alpyol / docker-compose.yml
Created June 16, 2023 20:44 — forked from cayman/docker-compose.yml
docker-compose haproxy nodejs php mysql
mysql-db:
image: mysql
hostname: mysql-db
ports:
- "3306:3306"
volumes:
- ./data/mysql:/var/lib/mysql
- ./data/script:/docker-entrypoint-initdb.d
environment:
- MYSQL_ROOT_PASSWORD=${DBP_ROOT}
@alpyol
alpyol / sream_function.php
Created May 1, 2023 19:03 — forked from techjewel/sream_function.php
Stream a mp3 file using php when you need to protect the file
<?php
function zcast_stream($file, $content_type = 'application/octet-stream') {
@error_reporting(0);
// Make sure the files exists, otherwise we are wasting our time
if (!file_exists($file)) {
header("HTTP/1.1 404 Not Found");
exit;
}
@alpyol
alpyol / .htaccess
Created March 9, 2023 12:33 — forked from seoagentur-hamburg/.htaccess
UPDATE 2022/10: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2.0.6 - 10/2022
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@alpyol
alpyol / wget.php
Created February 23, 2023 18:13 — forked from alash3al/wget.php
wget() in PHP, no more curl, just one line call
<?php
/**
* wget just like linux wget command
*
* @author Mohammed Al Ashaal <is.gd/alash3al>
* @version 1.0.0
* @license MIT License
*
* @param string $url example 'http://site.com/xxx?k=v'
* @param string $method example 'GET'
@alpyol
alpyol / index.html
Created July 12, 2022 22:00 — forked from gaearon/index.html
wordle v2 (tiny wordle clone i built during a stream) https://www.youtube.com/watch?v=xGyUyGbfOBo
<div id="screen">
<h1>Wordle</h1>
<div id="grid"></div>
<div id="keyboard"></div>
</div>
<style>
body, html {
background: #111;
color: white;
font-family: sans-serif;
@alpyol
alpyol / Bash State Machine
Created June 20, 2022 21:33 — forked from rhysrhaven/Bash State Machine
Simple bash state machine to re-run script in the same place after failure. Better to use case statement fall through if you have Bash 4.
#!/bin/bash
LOL=/tmp/LOLZ
RUNNING=true
while $RUNNING; do
case $([ -f $LOL ] && cat $LOL) in
INIT)
echo "Reached INIT State. Moving to WORK state."
echo "WORK" > $LOL
@alpyol
alpyol / index.html
Created June 4, 2020 13:54 — forked from shiawuen/index.html
Sample to upload file by chunk
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>test upload by chunk</title>
</head>
<body>
<input type="file" id="f" />
<script src="script.js"></script>
@alpyol
alpyol / URLSession Calls in Swift 3.0.1
Created December 21, 2019 01:17 — forked from cmoulton/URLSession Calls in Swift 3.0.1
URLSession Calls in Swift 3.0.1
func makeGetCall() {
// Set up the URL request
let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1"
guard let url = URL(string: todoEndpoint) else {
print("Error: cannot create URL")
return
}
let urlRequest = URLRequest(url: url)
// set up the session
@alpyol
alpyol / container_ip.bash
Created November 3, 2019 15:29 — forked from zainengineer/container_ip.bash
Get docker container ip
#!/usr/bin/env bash
#inside docker container
HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
CONTAINER_IP=$(curl "$HOST_IP:8000" 2>/dev/null)
echo "container ip is $CONTAINER_IP"
@alpyol
alpyol / httpie.sh
Created June 11, 2019 23:42 — forked from chris-rock/httpie.sh
Httpie Quick Install Ubuntu 14.04
apt-get update && apt-get install -y curl && curl --silent https://bootstrap.pypa.io/get-pip.py |python3 && pip install --upgrade httpie