Skip to content

Instantly share code, notes, and snippets.

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

Can Ngo ngocongcan

🏠
Working from home
  • Da nang, Vietname
View GitHub Profile
@ngocongcan
ngocongcan / clean_code.md
Created August 13, 2022 03:58 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

https://sourabhbajaj.com/mac-setup/iTerm/tree.html
@ngocongcan
ngocongcan / valet.conf
Created April 13, 2020 15:02 — forked from poul-kg/valet.conf
CORS Rules for Laravel Valet Nginx
# To enable CORS you should add lines with CORS rules below to your valet.conf file
# Find the file /usr/local/etc/nginx/valet/valet.conf - this is Valet conf for Nginx
# of try to execute `locate valet.conf` and find the `valet.coinf` in `nginx` subdirectory
# after you edit your valet.conf do not forget to execute `valet restart`
server {
listen 80 default_server;
root /;
charset utf-8;
client_max_body_size 128M;
<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>
$(document).ready(function (){
$("#click").click(function (){
$('html, body').animate({
scrollTop: $("#div1").offset().top
}, 2000);
});
});
public function massDownloadAction(Request $request) {
$documentids = $request->get('documentids', []);
$dir = $this->container->getParameter('documents_dir');
$repo = $this->getDoctrine()->getManager()->getRepository(Documents::class);
// Create new Zip Archive.
$zip = new \ZipArchive();
$now = date("Y-m-d H-i-s");
$zipName = 'Documents-' . $now . '.zip' ;
$zip->open($zipName, \ZipArchive::CREATE);
foreach ($documentids as $id) {
sudo initctl list |grep rabbit
rabbitmq-notif start/running, process 18499
rabbitmq-rest-api-batch start/running, process 18526
rabbitmq-synch start/running, process 18490
rabbitmq-user_data start/running, process 18546
rabbitmq-rest-api-batch-mail start/running, process 18537
rabbitmq-threaded-rest-api-batch stop/waiting
rabbitmq-legacy-importer start/running, process 18516
rabbitmq-img start/running, process 18479
DROP FUNCTION IF EXISTS fn_remove_accents;
DELIMITER |
CREATE FUNCTION fn_remove_accents( textvalue VARCHAR(10000) ) RETURNS VARCHAR(10000)
BEGIN
SET @textvalue = textvalue;
-- ACCENTS
SET @withaccents = 'ŠšŽžÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝŸÞàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿþƒàáạảãâầấậẩẫăằắặẳẵèéẹẻẽêềếệểễìíịỉĩòóọỏõôồốộổỗơờớợởỡùúụủũưừứựửữỳýỵỷỹđÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸĐ';
for %%i in ("output\*.mp4") DO ffmpeg -i "%%i" -i watermark.png -filter_complex "overlay=1110:85" -pix_fmt yuv420p -c:a copy "%%~ni.mp4"
pause
:: ffmpeg -i input.mp4 -i image.png \
::-filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" \
::-pix_fmt yuv420p -c:a copy \
::output.mp4
@ECHO OFF
Setlocal EnableDelayedExpansion
set INPUT=C:\Users\Administrator\Desktop\ffmpeg-20180410-d64183e-win64-static\ffmpeg-20180410-d64183e-win64-static\bin\A1
set OUTPUT=C:\Users\Administrator\Desktop\ffmpeg-20180410-d64183e-win64-static\ffmpeg-20180410-d64183e-win64-static\bin\A2
: encode video
for %%i in ("input\*.mp4") DO ffmpeg -i "%%i" -ss 00:00:05 -to 00:12:57 -c copy "output/%%~ni.mp4"
pause
REM -i: This specifies the input file. In that case, it is (input.mp4).
REM -ss: Used with -i, this seeks in the input file (input.mp4) to position.
xcode-select --install
# Install dependencies
brew install wget autoconf openssl libjpeg libpng lzlib curl imap-uw readline postgresql libxml2 mcrypt gettext libxslt homebrew/dupes/libiconv icu4c expat bison webp freetype
# Dirs
mkdir -p /Applications/MAMP/bin/php/php7.1.12/include
cd /Applications/MAMP/bin/php/php7.1.12/include
# Download PHP 7.1.12 sources