Skip to content

Instantly share code, notes, and snippets.

@TinyPoro
TinyPoro / docker-for-mac.md
Created May 6, 2024 07:28 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@TinyPoro
TinyPoro / m3u8-to-youtube-live.md
Created February 11, 2021 03:56 — forked from qntmpkts/m3u8-to-youtube-live.md
Restream m3u8 stream with ffmpeg to youtube live

Setup YouTube Live Event

Head on over to your YouTube live Events page (https://www.youtube.com/my_live_events).

Create a new live event that is unlisted (or private) and of Custom type.

Under Basic ingestion choose 1500 Kbps - 4000 kbps (720p).

Check the Enable 60fps box.

<?php
declare(strict_types = 1);
namespace App\Kafka;
use RdKafka;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@TinyPoro
TinyPoro / system_usage_log.sh
Created June 17, 2020 07:08 — forked from vuthaihoc/system_usage_log.sh
System usage bash
#!/bin/bash
## Use : ss command
## variable for change :
##
##----------
Timetemp='%H%M'
Time=$(date +"${Timetemp}")
Date=$(date +"%y%m%d")
Yest=$(date --date="1 day ago" +"%y%m%d")
#Day=$(date +"%a")
ffmpeg -i data/video.mp4 -vcodec h264 -b:v 1000k -acodec mp2 data/output.mp4
public function recurse_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
$this->recurse_copy($src . '/' . $file,$dst . '/' . $file);
}
else {
copy($src . '/' . $file,$dst . '/' . $file);
## html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="wraper">
<div class="main h2000 bg-green">
Phần chính trang web
<br/> Phần chính trang web
@TinyPoro
TinyPoro / Parse multi form in Python
Last active November 28, 2020 16:35
Parse multi form in Python
def parse_multi_form(form):
data = {}
for url_k in form:
v = form[url_k]
ks = []
while url_k:
if '[' in url_k:
k, r = url_k.split('[', 1)
ks.append(k)
if r[0] == ']':
@TinyPoro
TinyPoro / Install php full ext
Last active September 3, 2019 07:30
Install php full ext
apt-get -y install php7.1-opcache php7.1-fpm php7.1 php7.1-common php7.1-gd php7.1-mysql php7.1-imap php7.1-cli php7.1-cgi php-pear php-auth php7.1-mcrypt mcrypt imagemagick libruby php7.1-curl php7.1-intl php7.1-pspell php7.1-recode php7.1-sqlite3 php7.1-tidy php7.1-xmlrpc php7.1-xsl memcached php-memcache php-imagick php-gettext php7.1-zip php7.1-mbstring
@TinyPoro
TinyPoro / Storing object in binary file
Last active September 3, 2019 07:31
Storing object in binary file
*Note: $obj can be any type of data : object, array, ....
1. Storing object in binary file
//convert obj to binary data
$obj = new Class();
$serialized_data = serialize($obj);
$binary_data = unpack("C*",$serialized_data);
//store binary data in binary file
$file = fopen('binary', 'w+');