Skip to content

Instantly share code, notes, and snippets.

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

Azhar nian nian88

🏠
Working from home
View GitHub Profile
@nian88
nian88 / postgres-backup-replica.md
Created September 20, 2023 12:38 — forked from tcpipuk/postgres-backup-replica.md
Setting Up a Replica for Backups for Postgres 15 in Docker

Setting Up a Replica for Backups for Postgres 15 in Docker

Introduction

Backing up a write-heavy database like Synapse can be a challenge: in my case, a dump of the database would take >15 minutes and cause all sorts of performance and locking issues in the process.

This guide will walk you through setting up replication from a primary Postgres 15 Docker container to a secondary container dedicated for backups. By the end, you'll have a backup system that's efficient, minimizes performance hits, and ensures data safety.

Preparing Docker Compose

@nian88
nian88 / Dockerfile
Last active July 12, 2022 16:36
implementasi supervisor laravel dan apache di dcoker
FROM php:7.4-apache
# Install composer
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Install required composer extensions
RUN apt-get update && apt-get install -qqy libzip-dev libpq-dev unzip --no-install-recommends
RUN apt-get install supervisor -qqy
RUN docker-php-ext-install zip
RUN docker-php-ext-install mysqli pdo pdo_mysql
@nian88
nian88 / input-type.js
Created July 12, 2022 02:20
memfilter inputan pada text html
$( document ).ready(function() {
$('.noSymbol').keypress(function (e) {
var txt = String.fromCharCode(e.which);
if (!txt.match(/[A-Za-z0-9&.]/)) {
return false;
}
});
$('.numberOnly').keypress(function (e) {
@nian88
nian88 / install-docker-mint.sh
Last active February 22, 2018 03:40 — forked from Simplesmente/install-docker-mint.sh
Install docker Linux Mint
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates -y
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo echo deb https://apt.dockerproject.org/repo ubuntu-xenial main >> /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get purge lxc-docker
sudo apt-get install linux-image-extra-$(uname -r) -y
sudo apt-get install docker-engine cgroup-lite apparmor -y
sudo usermod -a -G docker $USER
sudo service docker start
@nian88
nian88 / controller.php
Created March 4, 2017 16:15 — forked from rizkysetiawanel/controller.php
Load scroll dengan codeigniter, js->controller->model->view
public function auto_halaman($num)
{
$data['anime_data'] = $this->anime_panel_model->mengambil_data2($num); //ini untuk menload data posting nya
$this->load->view('browse/front/anime_view', $data); // ini untuk ke view nya
}
@nian88
nian88 / php-webscraping.md
Created October 12, 2016 14:00 — forked from anchetaWern/php-webscraping.md
web scraping in php

Have you ever wanted to get a specific data from another website but there's no API available for it? That's where Web Scraping comes in, if the data is not made available by the website we can just scrape it from the website itself.

But before we dive in let us first define what web scraping is. According to Wikipedia:

{% blockquote %} Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. {% endblockquote %}

@nian88
nian88 / Simpan Gambar Dari URL Ke Internal Storage.java
Last active April 6, 2016 13:36
Simpan Gambar Dari URL Ke Internal Storage
public void simpan(View v){
Picasso.with(getApplicationContext()).load(url).into(new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
try {
String root = Environment.getExternalStorageDirectory().toString();
File myDir = new File(root + "/gambar");
if (!myDir.exists()) {
myDir.mkdirs();
}