Skip to content

Instantly share code, notes, and snippets.

View kriwil's full-sized avatar

Aldiantoro Nugroho kriwil

View GitHub Profile
@kriwil
kriwil / keybase.md
Created February 9, 2017 14:53
keybase

Keybase proof

I hereby claim:

  • I am kriwil on github.
  • I am kriwil (https://keybase.io/kriwil) on keybase.
  • I have a public key ASDMRP28YgLI5ABMyeXFWNl5ANGdXFPLoI_31kmkozsHngo

To claim this, I am signing this object:

@kriwil
kriwil / renderers.py
Created December 31, 2016 14:44
CamelCaseJSONRenderer
# -*- coding: utf-8 -*-
from rest_framework.renderers import JSONRenderer
# http://stackoverflow.com/a/19053800
def to_camel_case(snake_str):
components = snake_str.split('_')
# We capitalize the first letter of each component except the first one
# with the 'title' method and join them together.
@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
@kriwil
kriwil / webpack.config.js
Created February 13, 2016 10:40
webpack
/* ex: set tabstop=2 shiftwidth=2 expandtab: */
var path = require("path");
var webpack = require("webpack");
var autoprefixer = require("autoprefixer");
module.exports = {
devtool: "eval",
entry: [
"webpack-dev-server/client?http://localhost:3000",
def switch_case_test():
def one():
print 'one'
def two():
print 'two'
def three():
print 'three'
@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];'):
import random
from Tkinter import *
class Application(Frame):
wait = 50
def __init__(self, master=None):
course_fields = {
'labster_demo': False,
'is_browsable': False,
'invitation_only': True,
'max_student_enrollments_allowed': 3,
'labster_license': True,
}
if fields:
course_fields.update(fields)
{% for choice in form.field %}
<label>
{{ choice.choice_label }}
{{ choice.tag }}
</label>
{% endfor %}
<?php
include("inc/include.php");
$points_upload = intval($config['points_upload']);
$SID = intval($_SESSION['USERID']);
$SVERIFIED = intval($_SESSION['VERIFIED']);
if ($SID != "" && $SID >= 0 && is_numeric($SID) && ($SVERIFIED > 0))
{
$ctime = 24 * 60 * 60;