Skip to content

Instantly share code, notes, and snippets.

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

Achmad Fatoni achmadfatoni

🏠
Working from home
View GitHub Profile
@achmadfatoni
achmadfatoni / resize_scale_change_video_resolution_using_ffmpeg.md
Last active April 9, 2022 17:13
Resize/Scale/Change video resolution using ffmpeg

Check original video resolution

ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 filename-here.mp4

you will see file resolution like 1280x720

then resize to expected resolution:

@achmadfatoni
achmadfatoni / example.puml
Created December 10, 2020 08:02 — forked from QuantumGhost/example.puml
A simple template for PlantUML to draw ER diagram.The basic idea comes from http://plantuml.sourceforge.net/qa/?qa=331/database-modeling
@startuml
' uncomment the line below if you're using computer with a retina display
' skinparam dpi 300
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >>
' we use bold for primary key
' green color for unique
' and underscore for not_null
!define primary_key(x) <b>x</b>
!define unique(x) <color:green>x</color>
!define not_null(x) <u>x</u>
@achmadfatoni
achmadfatoni / node_nginx_ssl.md
Created July 30, 2020 15:38 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@achmadfatoni
achmadfatoni / generate_ssh_key
Created July 21, 2020 22:24
Generate ssh key
ssh-keygen -t rsa -b 4096 -C "achmadfatoni(replace with name)"
<?php
/**
* It's an algorithm for generating a random permutation of a finit sequence - in plain terms, the algorithm shuffles the sequence.
*
* Reference: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
*/
function MyShuffle(&$arr) {
@achmadfatoni
achmadfatoni / ssl_nginx.conf
Last active December 26, 2017 21:15
letsencrypt laravel configuration
## http://domain.com and http://www.domain.com redirect to https://www.domain.com
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name domain.com www.domain.com;
include /etc/nginx/snippets/letsencrypt.conf;
location / {
return 301 https://www.domain.com$request_uri;
@achmadfatoni
achmadfatoni / guzzle_raw_post_request.php
Created August 29, 2017 09:21
Guzzle Raw POST request
$client = new Client();
$array = [];
$res = $client->request('POST', $url, [
'body' => json_encode($array),
'headers' => [
'Content-Type' => 'application/json',
]
]);
@achmadfatoni
achmadfatoni / delete_post
Created August 19, 2017 04:49
delete post
public function delete($id)
{
$post = Post::find($id);
if ($post) {
$post->delete();
return response()->json([
'message' => 'Post has been deleted'
]);
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected $table = 'posts';
@achmadfatoni
achmadfatoni / simple_api_lumen_update_controller
Created August 18, 2017 12:37
simple_api_lumen_update_controller
public function update(Request $request, $id)
{
$post = Post::find($id);
if ($post) {
$post->update($request->all());
return response()->json([
'message' => 'Post has been updated'
]);