Skip to content

Instantly share code, notes, and snippets.

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

Ahmad aginanjar

🏠
Working from home
View GitHub Profile
@aginanjar
aginanjar / scast.sh
Created July 7, 2023 16:54
ffmpeg screencast command sample
#!/bin/bash
ffmpeg -f x11grab -video_size 1920x1080 -framerate 25 -i $DISPLAY -c:v ffvhuff ~/Videos/ok.mkv
<?php
interface Phone {
public function turnOn();
}
class PhoneUser {
@aginanjar
aginanjar / find-smallest-int.ts
Created July 6, 2019 04:12
Find the smallest missing integer, unsorted array is given.
let findMissing = (list: Array<number>): number => {
// tentukan nilai terkecil dari bilangan positive int/number
let res = 1
// tentukan nilai terbesar dari array
let max = Math.max.apply(Math, list);
// eliminasi bilangan negative dan 0
let filteredList = list.filter(l => l > 0)
// cari bilangan dengan nilai terkecil (res) hingga terbesar (max) yang tidak termasuk dalam array inputan,
@aginanjar
aginanjar / rsync-example.md
Created December 18, 2018 03:30
Example of rsync (file copying tool)

Server to Local

$ rsync -avz -e --progress "/usr/bin/ssh -i /Users/local/if-any.pem" user@your-remote-server:/home/server/path/your-file.txt /Users/local/path/

or without *.pem

rsync -avz --progress user@your-remote-server:/var/www/ /Users/local/file.extension
@aginanjar
aginanjar / .vimrc
Created August 4, 2018 15:29 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@aginanjar
aginanjar / xubuntu_xenial_config.md
Created April 30, 2017 17:34
My Xubuntu Xenial Config

Change repository on source list, I'm using source from Indonesia

cp /etc/apt/sources.list /etc/apt/sources.list.bak

vi /etc/apt/sources.list

deb ftp://ftp.itb.ac.id/pub/ubuntu xenial main restricted universe multiverse
deb ftp://ftp.itb.ac.id/pub/ubuntu xenial-updates main restricted universe multiverse
deb ftp://ftp.itb.ac.id/pub/ubuntu xenial-security main restricted universe multiverse
deb ftp://ftp.itb.ac.id/pub/ubuntu xenial-backports main restricted universe multiverse
deb ftp://ftp.itb.ac.id/pub/ubuntu xenial-proposed main restricted universe multiverse
# I'm running this configuration host on Mac Osx.
# Not testing this configuration on Linux Host yet.
<VirtualHost *:80>
DocumentRoot "/path/to/yii/frontend/web"
ServerName pos-ebc.frontend.dev
Alias "/new_path" "/path/to/yii/new_path"
<Directory "/path/to/yii/frontend/web">
AllowOverride All
Require all granted

How to change sql mode on MySQL


I'm using MySql v 5.7.9. After googling, found some interesting article.

Go through SQL Client, then paste some code SELECT @@sql_mode;. And taraaa~ it shows me this result : ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION.

Just set sql_mode to '' with this command SET sql_mode = ''; OR SET GLOBAL sql_mode = ''; Hope it'll helps. =D

Good luck.

@aginanjar
aginanjar / simple_border.css
Created December 31, 2014 07:26
Create simple table with css.
.row {
display: table-row;
}
.col {
display: table-cell;
/*border:solid 1px red; // display border */
}
@aginanjar
aginanjar / datetime-range
Created December 27, 2014 16:48
Implement doctrine datetime picker range on Sonata Admin Filter by @webdevilovers
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
...
->add('createdAt', 'doctrine_orm_datetime_range', array(),
'sonata_type_date_range',
array(
'required' => false,
'widget' => 'single_text',
'attr' => array(