Skip to content

Instantly share code, notes, and snippets.

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

Benny Christanto niotech

🏠
Working from home
  • Code-Latte
  • Indonesia
View GitHub Profile
@niotech
niotech / steps_migrate_mariadb_10__to__mysql_8.md
Created May 2, 2024 11:22
Migrate DB from MariaDB 10 to MySQL 8

At MariaDB

Check on source

sudo mysql -u root -p

SHOW databases;

+----------------------------+
| Database                   |
+----------------------------+
@niotech
niotech / increase_linux_swap_size.md
Last active May 2, 2024 13:37
Increase Linux (Debian / Ubuntu) Swap Size

Resize Swap to 8GB

Turn swap off

This moves stuff in swap to the main memory and might take several minutes

sudo swapoff -a

Create an empty swapfile

Note that "1G" is basically just the unit and count is an integer.

Together, they define the size. In this case 8GB.

sudo dd if=/dev/zero of=/swapfile bs=1G count=8

@niotech
niotech / djangAdmin-EntryLogAdmin.py
Created April 17, 2024 04:17 — forked from malikalbeik/djangAdmin-EntryLogAdmin.py
When added to any admin.py will enable any superuser to see all the entry logs in the Django admin page
from django.contrib import admin
from django.contrib.admin.models import LogEntry, DELETION
from django.utils.html import escape
from django.urls import reverse
from django.utils.safestring import mark_safe
@admin.register(LogEntry)
class LogEntryAdmin(admin.ModelAdmin):
date_hierarchy = 'action_time'
@niotech
niotech / Install-php-mysql-apache-on-osx-with-brew.md
Created April 16, 2017 13:23 — forked from GabLeRoux/Install-php-mysql-apache-on-osx-with-brew.md
Detailed steps to install PHP, MySQL, Apache and some usefull extensions such as xDebug on a mac running Mac Os X. Also included: PostgreSQL.

Install PHP, MySQL, PostgreSQL, Apache and xDebug on a Mac

You should have some tools installed like Homebrew, a text editor such as Sublime Text and it's subl command line app inside a bin folder and some basic terminal knowledge.

This gist is a more detailed version of niepi's gist with things that worked for me. It may help someone :)

Install PHP

$ brew install php --with-apache --with-mysql --with-pgsql --with-intl
@niotech
niotech / Uninstall-pkg.md
Created April 8, 2017 15:07 — forked from githubutilities/Uninstall-pkg.md
Uninstall pkg manually in OS X

Mac Uninstall pkg Manually

  • using pkgutil
# list all your installed packages
pkgutil --pkgs

# show your package info
pkgutil --pkg-info 
@niotech
niotech / jquery.currency.js
Last active August 29, 2015 14:02
jquery.currency.js : jQuery plugin to create text input as currency format then validate and accept numbers only
$.fn.CurrencyInput = function(options){
var opts = $.extend({}, $.fn.CurrencyInput.defaults, options);
return this.each(function(){
var el = $(this);
var form_group = el.parents(opts.parent_wrapper);
var message_wrapper = form_group.find(opts.message_notification);
var min = opts.min, max = opts.max;
var value_target = opts.value_target;
// Time difference function
function timeDiff(start, end) {
//today, now!
//Get the diff
var diff = end - start;
//Create numbers for dividing to get hour, minute and second diff
var units = [
1000 * 60 * 60 *24,
1000 * 60 * 60,
1000 * 60,
#-*- coding: utf-8 -*-
import urlparse
from django.contrib.auth import REDIRECT_FIELD_NAME, login
from django.contrib.auth.forms import AuthenticationForm
from django.http import HttpResponseRedirect
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from django.views.generic.edit import FormView
from django.conf import settings
@niotech
niotech / index.html
Created December 28, 2012 13:29
A CodePen by Benny Christanto. CSS Swinging Panel Menu - A simple, clean pure CSS menu that uses keyframe animation to create a "swining panel" effect for sub nav. I am having trouble getting it to work in Opera but performs well in Chrome, Safari and Firefox (but getting a weird flicker). And, of course, doesn't work in IE but degrades well.
<div id="container">
<ul id="menu">
<li><a href="#">About Me</a>
<ul>
<li><a href="#">Lorem ipsum dolor</a></li>
<li><a href="#">Maecenas lacinia sem</a></li>
<li><a href="#">Suspendisse fringilla</a></li>
</ul>
</li>
<li><a href="#">Portfolio</a>
@niotech
niotech / index.html
Created December 28, 2012 13:29
A CodePen by Benny Christanto. CSS Swinging Panel Menu - A simple, clean pure CSS menu that uses keyframe animation to create a "swining panel" effect for sub nav. I am having trouble getting it to work in Opera but performs well in Chrome, Safari and Firefox (but getting a weird flicker). And, of course, doesn't work in IE but degrades well.
<div id="container">
<ul id="menu">
<li><a href="#">About Me</a>
<ul>
<li><a href="#">Lorem ipsum dolor</a></li>
<li><a href="#">Maecenas lacinia sem</a></li>
<li><a href="#">Suspendisse fringilla</a></li>
</ul>
</li>
<li><a href="#">Portfolio</a>