Skip to content

Instantly share code, notes, and snippets.

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

Kholid Fuadi kholidfu

🏠
Working from home
View GitHub Profile
@kholidfu
kholidfu / django_nginx_progressbarupload.txt
Last active September 23, 2015 09:14
django + nginx + progressbarupload
# nginx.conf
upload_progress proxied 1m;
# /sites-available/default
upstream app_server {
server 127.0.0.1:8000 fail_timeout=0;
}
server {
listen 80;
@kholidfu
kholidfu / kumpulan_error_django.txt
Last active September 30, 2015 18:36
Kumpulan error django
* ProgrammingError... relation...
-- backup data
-- dropdb dbname
-- createdb dbname
* coercing to Unicode: need string or buffer, Guru found
terjadi biasanya karena ada relasi bertingkat
-- def __unicode__(self):
return self.nama.nama
@kholidfu
kholidfu / export_import_table_postgres
Last active September 14, 2015 05:52
back and import table in postgres
export using pgadmin
-- backup
-- format plain
-- dump options #1 : only data
-- dump options #2 : use column inserts
: use insert commands
sudo -u postgres -i
psql
@kholidfu
kholidfu / find_dups.sql
Last active September 11, 2015 11:30
find duplicate in postgres
select nama,count(*) from infaq_siswa group by nama having count(*) > 1;
@kholidfu
kholidfu / minecraft_mod
Last active August 29, 2015 14:24
minecraft forge mod setup
Install latest version of forge source (1.8)
Upgrade java to 1.7 (latest)
# export JAVA_HOME="$(/usr/libexec/java_home -v 1.6)"
# export JVM_ARGS="-Xmx1024m -XX:MaxPermSize=256m"
gradlew setupDecompWorkspace
=====
Reference:
@kholidfu
kholidfu / laravel_notes
Last active August 29, 2015 14:24
Notes on Laravel Framework
Here are some of my notes on Laravel framework:
- it's better using homestead rather than using old-fashioned-setup-everything-individually.
- just always to create a copy of .env and name it something else like .env.example and filled up
with all app info except credential of course, this will make you ease the git clone pain.
- i don't know if once the app is deployed, do we need to do dependencies update? if yes, then
I suggest to do it first in localhost, using command: composer update :: if everythings goes
well, then you can do in your production server.
@kholidfu
kholidfu / laravel5_pagination.php
Last active August 29, 2015 14:22
laravel 5 pagination
<?php
// App/Kholid/CustomPaginationLinks.php
namespace Kholid;
use Illuminate\Pagination\BootstrapThreePresenter;
class CustomPaginationLinks extends BootstrapThreePresenter {
@kholidfu
kholidfu / flask_auth
Created October 31, 2014 04:29
flask auth
https://blog.openshift.com/use-flask-login-to-add-user-authentication-to-your-python-application/
@kholidfu
kholidfu / flask_upload_ajax
Last active April 28, 2018 10:54
python flask upload file with ajax
<!-- source: http://stackoverflow.com/questions/18334717/how-to-upload-a-file-using-an-ajax-call-in-flask -->
<!-- yang perlu diingat, button yang untuk trigger dipisah dari form2 yang mau di-submit -->
<!-- html -->
<form id="upload-file" method="post" enctype="multipart/form-data">
<fieldset>
<label for="file">Select a file</label>
<input name="file" type="file">
</fieldset>
<fieldset>
@kholidfu
kholidfu / install_lxml.txt
Last active August 29, 2015 14:06
install lxml inside virtualenv
sudo apt-get install libxml2-dev libxslt1-dev lib32z1-dev python-dev python3-dev