Skip to content

Instantly share code, notes, and snippets.

@zikrach
zikrach / server.r
Created January 11, 2018 16:52 — forked from wch/server.r
renderImage example for Shiny
shinyServer(function(input, output, clientData) {
output$myImage <- renderImage({
# A temp file to save the output.
# This file will be removed later by renderImage
outfile <- tempfile(fileext='.png')
# Generate the PNG
png(outfile, width=400, height=300)
hist(rnorm(input$obs), main="Generated in renderImage()")
dev.off()
@zikrach
zikrach / form.html
Created February 24, 2014 18:00
form html+css
<!DOCTYPE html>
<html>
<head>
<title>Форма и progressive enhancement</title>
</head>
<body>
<form class="login" method="post" action="">
<label for="login">Логин</label>
<input type="text" id="login" name="login" />
<label for="password">Пароль</label>
# coding: utf-8
# author: damirazo
from django.views.generic import ListView
from models import Post
class Posts(ListView):
"""
Список всех доступных статей
"""
@zikrach
zikrach / gist:8368164
Created January 11, 2014 07:35
Write message over SSH
ssh user@host
export DISPLAY=:0
export XAUTHORITY=/home/user/.Xauthority
notify-send 'А ну отошёл от моего компа!'
@zikrach
zikrach / email.py
Created January 10, 2014 21:50
Sending Email From Python Using Command Line
#account setup
username = '***';
password = '***';
server = 'smtp.gmail.com:587';
#imports
from time import sleep;
import smtplib;
from email.mime.application import MIMEApplication
from email.mime.text import MIMEText;
@zikrach
zikrach / mDocument.py
Created January 4, 2014 21:42
cteate table sqlite3
@classmethod
def create_table(self):
# TODO 1. Автоматично формувати SQL-команду створення таблиці
print("Creating document table")
path = os.path.expanduser(
"~/python/virtualenv/python3/virt_Python3/home/data.db")
try:
connection = sqlite3.connect(path)
cursor = connection.cursor()
cursor.execute(