Skip to content

Instantly share code, notes, and snippets.

View swdevbali's full-sized avatar
:octocat:
Bringing back my golden era of programming! Wohoo!

Eko Suprapto Wibowo swdevbali

:octocat:
Bringing back my golden era of programming! Wohoo!
View GitHub Profile
Private Sub MainWindow_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Text = Application.ProductName & " version " & Application.ProductVersion
Config.init()
enterView(Pages.Item("home"))
End Sub
{% macro render_field(field) -%}
{% set with_label = kwargs.pop('with_label', False) %}
{% set placeholder = '' %}
{% if not with_label %}
{% set placeholder = field.label.text %}
{% endif %}
<div class="form-group {% if field.errors %}error{% endif %}">
{% if with_label %}
<label for="{{ field.id }}" class="control-label">
{{ field.label.text }}{% if field.flags.required %} *{% endif %}:
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{$url->blogLink()}"><img class="img-responsive" src="{$url->getTemplateFile("img/pythonthusiast.png")}"></img></a>
</div>
@swdevbali
swdevbali / redisobject.py
Last active June 1, 2022 19:24
Redis store data as string, getting it back and trying to dump it as Json will still create json with string data type. We need to convert it back to correct data type using our own dict of types
__author__ = 'ekowibowo'
import os
import redis
from flask import jsonify, Flask
import json
REDIS_HOST = os.getenv('SS_ABTEST_REDIS_HOST', '192.168.59.103')
hkey = 'redisobject:whyweneedit'
r = redis.StrictRedis(host=REDIS_HOST)
@swdevbali
swdevbali / savejsoninredis.py
Created November 6, 2015 15:19
Simply json.dumps() => save to redis => redis.get => json.loads() => Python dict with proper data type created
__author__ = 'ekowibowo'
import json
import os
import redis
REDIS_HOST = os.getenv('SS_ABTEST_REDIS_HOST', '192.168.59.103')
r = redis.StrictRedis(host=REDIS_HOST)
for k in r.keys('abtest:experiments:*'):
r.delete(k)
print 'Hello world'
class HelloWorld{
public static void main(string arg){
System.out.println("Hello world!");
}
}
@swdevbali
swdevbali / quickstart.py
Created May 25, 2017 18:19
Send email using Google Client API
import gclient
from_ = '[email protected]'
to_ = '[email protected]'
title = 'Python vs Ruby vs Go'
body = 'Python FTW!'
message = gclient.create_message(from_, to_, title, body)
gclient.send(message)
print("Let's calculate triangles area using function")
def calculate_triangle(bottom, height):
return bottom * height / 2
tri1 = calculate_triangle(5, 10)
tri2 = calculate_triangle(6,8)
tri3 = calculate_triangle(10, 7)
print(tri1, tri2, tri3)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDvCaLC5PmKmm1kqFf0DMiPQ6KbY3yZi4qrtUsCluPNSer75mCwjZy0QQWF17CpQEXFlGe9kaRzyqZGeiMTZDblIuBPc0Y/M/eDNxVDsA9sKiDEb3rUd6mElbHgK0SecoLBFE29aMuqYwp/YRwG80vsRoMvWlJcuON2XbwiWeXrPnyqAIKzBjnIb0I7pSQkfFcTVwzal2q7wUEbG0+wezURuTB2xGZnYHll1GBRmNumkGC8tsg+2EXIwMYrfErhhD/LBoJ695gU4cYv79Fdo/dx0eI4lZWsqgXUOUfxHVvFxsFncHWEleWerQEzY14rEA+HmK9gOXwMlzJFBRKIZxX eko@eko-VirtualBox