Skip to content

Instantly share code, notes, and snippets.

View Dexus's full-sized avatar
🏠
Working from home

Josef Fröhle Dexus

🏠
Working from home
View GitHub Profile
@Dexus
Dexus / app.js
Last active August 29, 2015 13:57
Error 404 ExpressJS without Error Function
var express = require('express'),
mongoose = require('mongoose'),
app;
app = module.exports = express.createServer();
app.configure(function() {
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
@Dexus
Dexus / test1.py
Last active August 29, 2015 14:03
error json
import json
data = json.loads('[{"p_product":"ECON 101","p_qty":101,"p_tax":"19%","p_eprice":"123,99 \u20ac","p_gprice":"12.522,99 \u20ac"},{"p_product":"ECON 101","p_qty":101,"p_tax":"19%","p_eprice":"123,99 \u20ac","p_gprice":"12.522,99 \u20ac"},{"p_product":"ECON 101","p_qty":101,"p_tax":"19%","p_eprice":"123,99 \u20ac","p_gprice":"12.522,99 \u20ac"},{"p_product":"ECON 101","p_qty":101,"p_tax":"19%","p_eprice":"123,99 \u20ac","p_gprice":"12.522,99 \u20ac"}]')
document.merge_rows('p_product',**data)
# results in:
#
@Dexus
Dexus / error.
Last active August 29, 2015 14:03
error lxml ...
__merge_field
mf.text = text
File "lxml.etree.pyx", line 953, in lxml.etree._Element.text.__set__ (src/lxml/lxml.etree.c:44971)
File "apihelpers.pxi", line 685, in lxml.etree._setNodeText (src/lxml/lxml.etree.c:20341)
File "apihelpers.pxi", line 1393, in lxml.etree._utf8 (src/lxml/lxml.etree.c:26460)
TypeError: Argument must be bytes or unicode, got 'int'
@Dexus
Dexus / save_each_rctp_to.js
Last active September 24, 2015 13:54
save for each rcpt in haraka mail server
var fs = require('fs');
var os = require('os');
var tempDir = os.tmpdir();
exports.hook_queue = function(next, connection) {
var i;
var done=0;
var ws = [];
var rcpts = transaction.rcpt_to.lenght;
@Dexus
Dexus / auth_mysql.js
Created October 1, 2015 11:12
auth_mysql - not tested
// Authentication against a MySQL server
var net_utils = require('./net_utils');
var mysql = require('mysql');
var crypto = require('crypto');
exports.register = function() {
this.inherits('auth/auth_base');
}
exports.hook_capabilities = function(next, connection) {
@Dexus
Dexus / ZendOpcache + APCu
Created October 26, 2015 11:18 — forked from bcremer/ZendOpcache + APCu
Alternative Bytecodecache + Datacache based on ZendOpcache and APCu
# http://pecl.php.net/package/APCu
# http://pecl.php.net/package/ZendOpcache
# Install ZendOpcache
sudo pecl install ZendOpcache-beta
sudo -i
cat > /etc/php5/mods-available/opcache.ini << EOF
zend_extension=/usr/lib/php5/20100525/opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
@Dexus
Dexus / config.php
Created October 26, 2015 11:22 — forked from bcremer/config.php
Shopware 4 Debug-Configuration
'front' => array(
'noErrorHandler' => true,
'throwExceptions' => true,
),
// Template-Cache
'template' => array(
'forceCompile' => true,
),
<?php
$results = [];
foreach (range('A', 'Z') as $character) {
$results[$character] = [];
foreach (range(1, 26) as $number) {
$results[$character][] = $character . $number;
}
}
foreach ($results as $result) {
echo implode(', ', $result) . PHP_EOL;
@Dexus
Dexus / Go-SIRIS_CLA
Last active July 26, 2017 15:37 — forked from CLAassistant/SAP_CLA
Go-SIRIS Individual Contributor License Agreement
### Go-SIRIS Individual Contributor License Agreement
Thank you for your interest in contributing to open source software projects (“Projects”) made available by Go-SIRIS or its affiliates (“Go-SIRIS”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to Go-SIRIS in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact opensource@go-siris.com.
You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.
**Copyright License.** You hereby grant, and agree to grant, to Go-SIRIS a non-exclusive, perp
@Dexus
Dexus / mysql-docker.sh
Created November 27, 2017 21:27 — forked from nshtg/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE > backup.sql
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | gzip > backup.sql.gz
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | bzip2 > backup.sql.bz2
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
gunzip < backup.sql.gz | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
bunzip2 < backup.sql.bz2 | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE