Skip to content

Instantly share code, notes, and snippets.

View dgleba's full-sized avatar
😁
.

dgleba dgleba

😁
.
View GitHub Profile
@dgleba
dgleba / test.py
Created March 11, 2016 19:55 — forked from mrjoes/test.py
How to customize options in QuerySelectField. High level idea: 1. Hook `create_form` to change options when creating model and `edit_form` when editing model 2. Provide different `query_factory` for the field 3. Do filtering/population logic in the _get_parent_list Alternatively: 1. Can hook `scaffold_form` and change `form.parent.kwargs['query_…
from flask import Flask, request, url_for
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.admin.contrib import sqlamodel
from flask.ext import admin
# Create application
app = Flask(__name__)
# Create dummy secrey key so we can use sessions
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS `survey_001_models_from_tables` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `survey_001_models_from_tables` ;
-- -----------------------------------------------------
-- Table `survey_001_models_from_tables`.`organizations`
-- -----------------------------------------------------
@dgleba
dgleba / perfectelementary.bash
Created December 16, 2016 23:50
HowTo Install the perfect Elementary-OS
#Download Elementary OS from here:
#http://sourceforge.net/projects/elementaryos/files/stable/
#First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
#Install Google Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
@dgleba
dgleba / Minimal eclipse install
Last active May 24, 2017 13:31 — forked from mjwall/Minimal eclipse install
Minimal eclipse install
Tired of extra plugins and cruft in eclipse, I tried the following
1. Download platform binary runtime from
http://archive.eclipse.org/eclipse/downloads/drops4/R-4.6.1-201609071200/
2. Modify eclipse.ini, set -vm JAVA_HOME/bin/java for java 8 and -Xmx2048m
3. Open and run check for updates
@dgleba
dgleba / gitcreate.sh
Last active June 20, 2017 01:04 — forked from jerrykrinock/gitcreate.sh
This script create a new repo on github.com, then pushes to it the local repo from the current directory.It is a fork of https://gist.github.com/robwierzbowski/5430952/. Some of Rob's lines just didn't work for me, and to fix them I needed to make it more verbose so that a mere electrical engineer could understand it.
#!/bin/bash
#
# try https://github.com/github/hub/releases
# https://stackoverflow.com/questions/35124997/creating-github-repository-from-command-line
#
# This script create a new repo on github.com, then pushes the local repo from the current directory to the new remote.
# It is a fork of https://gist.github.com/robwierzbowski/5430952/. Some of Rob's lines just didn't work for me, and to fix them I needed to make it more verbose so that a mere electrical engineer could understand it.
@dgleba
dgleba / simple_args_parsing_sh.sh
Last active September 21, 2017 16:43 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Returns the result of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@dgleba
dgleba / ldif-to-csv.sh
Created February 28, 2018 11:51 — forked from dansimau/ldif-to-csv.sh
Shell script that reads LDIF data from STDIN and outputs as CSV.
#!/bin/bash
#
# Converts LDIF data to CSV.
# Doesn't handle comments very well. Use -LLL with ldapsearch to remove them.
#
# 2010-03-07
# dsimmons@squiz.co.uk
#
# Show usage if we don't have the right params
@dgleba
dgleba / docker-compose.yml
Created June 9, 2018 03:32 — forked from wwwebman/docker-compose.yml
Docker Compose For Wordpress, Maria/MYSQL, phpMyAdmin
version: '2'
services:
db:
container_name: database
image: mariadb # Pull mysql image from Docker Hub
ports: # Set up ports exposed for other containers to connect to
- "3306:3306"
volumes:
- ./dep/mysql:/docker-entrypoint-initdb.d
@dgleba
dgleba / Dockerfile
Created June 9, 2018 03:37 — forked from jcavat/Dockerfile
docker-compose with php/mysql/phpmyadmin/apache
FROM php:7.1.2-apache
RUN docker-php-ext-install mysqli