Skip to content

Instantly share code, notes, and snippets.

View repodevs's full-sized avatar

Edi Santoso repodevs

View GitHub Profile
@repodevs
repodevs / django.py
Last active March 24, 2017 09:06
Django Bypas CSRF and simple requests login
# app/views.py
from django.contrib.auth import authenticate, login
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def login_user(request):
user = authenticate(username=request.POST['username'], password=request.POST['password'])
login(request, user)
return HttpResponse("Logged In")
@repodevs
repodevs / coa.csv
Created April 28, 2017 16:29
Example Chart of Accounts
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
External ID;Code;Name;Allow Reconciliation;Type/ID
__export__.account_account_176;1.01.01.01;Kas Belum Disetor Cabang Bandung;True;3
__export__.account_account_177;1.01.01.02;Kas Kecil Cabang Bandung;True;3
__export__.account_account_174;1.01.04.01;Piutang Usaha Cabang Bandung;True;1
__export__.account_account_175;2.01.01.01;Hutang Usaha Cabang Bandung;True;2
;1.01.01.02;Kas Belum Disetor Cabang Bali;True;3
;1.01.01.03;Kas Kecil Cabang Bali;True;3
;1.01.04.02;Piutang Usaha Cabang Bali;True;1
;2.01.01.02;Hutang Usaha Cabang Bali;True;2
;1.01.01.03;Kas Belum Disetor Cabang Bekasi;True;3
@repodevs
repodevs / odoo_uninstall_addons.py
Created June 13, 2017 08:13
python script to uninstall odoo addons via xmlrpc
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Uninstall a module"""
import xmlrpclib
import argparse
import getpass
parser = argparse.ArgumentParser()
# Connection args
@repodevs
repodevs / cancel_reason.py
Created July 17, 2017 10:45
add field in existing odoo models
from odoo import models, fields, api, _
class SiteSurvey(models.Model):
_inherit = "site.survey"
cancel_reason = fields.Char("cancel reason")
class SiteSurveyWizard(models.TransientModel):
_name = "site.survey.wizard"

Keybase proof

I hereby claim:

  • I am repodevs on github.
  • I am repodevs (https://keybase.io/repodevs) on keybase.
  • I have a public key whose fingerprint is 32C0 64EA 1713 F990 2ACF 6B2B 96A3 FF2F 38AF 394C

To claim this, I am signing this object:

@repodevs
repodevs / kaskus.py
Created August 23, 2017 14:36 — forked from judotens/kaskus.py
Kaskus search using official API - just for fun
# PS:
# - Extract your own kaskus oauth consumer_key & consumer_secret frm native app. Ref: http://seriot.ch/abusing_twitter_api.php#3
# - No public doc found, but here i attach an api sample sniffed from mitmproxy
import urllib, urllib2
import time
import oauth.oauth as oauth
import string
import random
import sys, json
@repodevs
repodevs / product.py
Created August 24, 2017 05:59
an ugly method, to constrains odoo default_code (and name)
# -*- coding: utf-8 -*-
# © 2017 Edi Santoso <repodevs@gmail.com>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from odoo import api, fields, models, _
class Product(models.Model):
_inherit = 'product.template'
@api.constrains('default_code', 'name')
def _check_code(self):
@repodevs
repodevs / partner.py
Created September 6, 2017 05:48
odoo name_get inherit
# -*- coding: utf-8 -*-
# © 2017 Niaga Solution - Edi Santoso <repodevs@gmail.com>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, models
class Contact(models.Model):
_inherit = 'res.partner'
@api.multi
def name_get(self):
@repodevs
repodevs / phpmyadmin.conf
Created September 16, 2017 04:40
nginx PhpMyAdmin config example
# /etc/nginx/phpmyadmin.conf
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
#!/bin/bash
echo "Start Export Process"
echo "Log into Keybase..."
keybase login
echo "Exporting your PGP keys..."
keybase pgp export -o keybase.public.key
keybase pgp export -s -o keybase.private.key