Skip to content

Instantly share code, notes, and snippets.

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

agusmakmun

🏠
Working from home
View GitHub Profile
from django.db import models
from django.utils import timezone
from django.core.urlresolvers import reverse
from gtts import gTTS
from django.core.files.storage import default_storage as storage
from django.core.files.base import ContentFile
from cStringIO import StringIO
import requests.packages.urllib3
@agusmakmun
agusmakmun / django filefield accept.md
Last active February 2, 2016 17:25
django filefield accept image/* and video/*
@agusmakmun
agusmakmun / admin.py
Last active March 17, 2016 03:14
Dinamic upload File type for Gallery
from django.contrib import admin
from . import models
class GalleryAdmin(admin.ModelAdmin):
list_display = ("file_type", "title", "get_absolute_url", "created")
search_fields= ['title']
list_filter = ['created']
list_per_page = 5
admin.site.register(models.Gallery, GalleryAdmin)
@agusmakmun
agusmakmun / dirc
Created March 22, 2016 17:50 — forked from nullrndtx/dirc
DIRC - DracOS Irc Client
#!/bin/bash
# dirc - DracOS IRc Client
# Copyright (c) 2016 - randalltux
###################################
##### HOW TO #####
##### -h: hostname #####
##### -p: port #####
##### -n: nick #####
##### -k: password #####
##### -c: config #####
@agusmakmun
agusmakmun / bash.bashrc
Created March 22, 2016 21:23
Simple bash scripting for login before open the terminal.
### ===============================================
### Simple bash scripting for login before open the terminal.
### Credit: <Summon Agus> - [email protected]
### Location, end script of: /etc/bash.bashrc
### ===============================================
while true; do
# Don't exit at Ctrl-C
trap "echo" SIGINT
@agusmakmun
agusmakmun / Some Problem Ubuntu 14.04.md
Last active March 22, 2016 22:26
Some Problem Ubuntu 14.04 about lost audio and system settings
import argparse
def exist_user(string):
exist_users = ['taro','jiro','saburo','ichi','ni','san']
if string not in exist_users:
raise argparse.ArgumentTypeError("%s is not exist user"%(string))
return string
parser = argparse.ArgumentParser(prog='test command', description='this is description text.')
@agusmakmun
agusmakmun / argparse_action.py
Created April 4, 2016 19:11 — forked from Averroes/argparse_action.py
argparse action
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2010 Doug Hellmann. All rights reserved.
#
"""Show the built-in argument actions.
"""
#end_pymotw_header
import argparse
@agusmakmun
agusmakmun / iscsictl.py
Created April 4, 2016 19:11
argparse example
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Help iSCSI deployment.')
parser.add_argument('-s', '--service', choices=['target', 'initiator'],
default=None,
help='type of service deployment')
parser.add_argument('-o', '--host', default=None,
help='Host address for the machine to configure')
parser.add_argument('-t', '--target_host', default=None,
help='Host address where the initiator search the target')
parser.add_argument('-d', '--device', default='/dev/loop0',