Skip to content

Instantly share code, notes, and snippets.

View defrindr's full-sized avatar
👋
Hi there

Defri Indra Mahardika defrindr

👋
Hi there
View GitHub Profile
@defrindr
defrindr / Uploaded file yii2
Last active February 21, 2019 02:47
how to uploaded image/photo on yii2
1. goto view , change $form and add field to input file
<?php $form = ActiveForm::begin(['options'=>['enctype'=>'multipart/form-data']]); ?>
...
<?= $form->field($model,'image)->fileInput() ?> <!-- field to input file -->
...
<?= ActiveForm::end() ?>
@defrindr
defrindr / postgres_queries_and_commands.sql
Created February 21, 2019 02:56 — forked from formigarafa/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (>= 9.2)
SELECT pid,
age(clock_timestamp(), query_start) AS age,
usename, state, query, waiting,
age(clock_timestamp(), xact_start) AS xact_age
FROM pg_stat_activity
WHERE state != 'idle'
AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY age DESC;
@defrindr
defrindr / Python perulangan
Created February 21, 2019 03:40
contoh contoh perulangan di python
# membuat perulangan
# 10
# 9
# ...
# 1
for a in range(10,0,-1):
print a
@defrindr
defrindr / change GDM background
Last active February 21, 2019 05:15
tutorial how to change GDM background on ubuntu
1. Sediakan gambar yang akan digunakan sebagai background
2. buka folder /usr/share/gnome-shell/theme
3. Buka file gdm3.css
4. Tekan ctrl+w kemudian input #lockDialogGroup
5. Ganti url background dengan gambar yang tadi telah di sediakan
@defrindr
defrindr / output.txt
Created March 5, 2019 21:44 — forked from stamparm/output.txt
Sample sqlmap run
$ python sqlmap.py -u "http://192.168.21.128/sqlmap/mysql/get_int.php?id=1" -z "ign,flu,bat" --banner -f
sqlmap/1.0-dev-7614c81 - automatic SQL injection and database takeover tool
http://sqlmap.org
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting at 10:30:49
[10:30:49] [INFO] testing connection to the target url
@defrindr
defrindr / spintax.php
Created March 12, 2019 07:24 — forked from irazasyed/spintax.php
PHP: Text Spinner Class - Nested spinning supported.
<?PHP
/**
* Spintax - A helper class to process Spintax strings.
* @name Spintax
* @author Jason Davis - https://www.codedevelopr.com/
* Tutorial: https://www.codedevelopr.com/articles/php-spintax-class/
*/
class Spintax
{
public function process($text)
@defrindr
defrindr / README.md
Created March 12, 2019 21:45 — forked from macagua/README.md
Install a Bower package with Composer configuration for Yii2 project

Install Bower packages with Composer configuration for Yii2 project

Install two (02) Bower packages like jquery 2.2.4 and pickadate 3.5.6 with Composer configuration for Yii2 project

Installing Composer

$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
<?php
namespace common\models;
use Yii;
use \common\models\base\ModuleBank as BaseModuleBank;
class ModuleBank extends BaseModuleBank
{
...
<?php
use yii\helpers\Html;
use kartik\export\ExportMenu;
use kartik\grid\GridView;
use yii\helpers\Url;
...
<div class="module-materi-index">
<div class="box box-success">
<div class="box-header">
...
@defrindr
defrindr / RomDecConverter.py
Last active September 29, 2019 16:28
Converter Roman - Decimal with python
# Created function to convert num to roman
def dec2rom(num):
_m = int(num / 1000)
num = num % 1000
#
_d = int(num / 500)
num = num % 500
#
_c = int(num / 100)