Skip to content

Instantly share code, notes, and snippets.

View kriwil's full-sized avatar

Aldiantoro Nugroho kriwil

View GitHub Profile
docker ps -a | grep Exit | awk '{print $1}' |xargs docker rm
class AccountForm(forms.ModelForm):
class Meta:
model = Account
fields = ['first_name', 'last_name', 'email', 'password']
def __init__(self, *args, **kwargs):
self.university = kwargs.pop('university')
self.high_school = kwargs.pop('high_school')
self.department = kwargs.pop('department')
@kriwil
kriwil / test.py
Created September 29, 2014 07:41
class CreatePaymentTest(TestCase):
def setUp(self):
self.user = UserFactory()
self.payment = PaymentFactory()
self.product = ProductFactory()
self.url = reverse('api:create-payment')
self.headers = get_auth_header(self.user)
def test_post_new(self):
@kriwil
kriwil / hello_pyodbc.py
Last active June 11, 2021 16:24 — forked from rduplain/README.md
ubuntu connect to mssql server using pyodbc
"Proof connection at pyodbc level."
# Test pyodbc connection. Result is 42.
# Note parameters in connection string, <PARAMETER>.
import pyodbc
conn = pyodbc.connect('DRIVER=FreeTDS;SERVER=<IP_OR_HOSTNAME>;PORT=1433;DATABASE=<DATABASE_NAME>;UID=<USERNAME>;PWD=<PASSWORD>;TDS_Version=8.0;')
cursor = conn.cursor()
for row in cursor.execute('select 6 * 7 as [Result];'):
@kriwil
kriwil / podcastgen.py
Created March 15, 2016 01:35 — forked from alghanmi/podcastgen.py
Podcast Feed Generator -- Generate an podcast RSS feed for a set of media in a directory.
"""Podcast Feed Generator
Generate an podcast RSS feed for a set of media in a directory.
Use the list-extensions argument to see the list of supported extensions. You can add custom extensions using
Usage:
podcastgen.py gen <directory> --title=<podcast-title> --link=<podcast-link> --desc=<description> [--output=<rss-feed-file>] [--feed-link=<feed-url>] [--id=<podcast-id>] [--logo=<image_file>] [--category=<itunes-category> [--subcategory=<itunes-category>]] [--language=<language>] [--use-extension=<ext>]
podcastgen.py list-categories
podcastgen.py list-extensions
podcastgen.py -h | --help