Skip to content

Instantly share code, notes, and snippets.

View dfreudenberger's full-sized avatar

Daniel Freudenberger dfreudenberger

View GitHub Profile
@GET
public List<ProductDto> search(@InjectParam QueryParams params)
{
List<Product> products = productService.findAll(...);
return mapper.map(products);
}
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.rebuy.service.order.runner.OrderService</mainClass>
server {
listen 80;
server_name trunk.purchase.localhost.rebuy.loc;
root /Users/Daniel/Sites/php/rebuy-verkaufen/docroot;
index index.php;
if ($request_filename ~ "\.(ico|gif|jpg|jpeg|png|html|css|js|pdf)$") {
rewrite ^/verkaufen(.*) $1 last;
}
@Transactional(readOnly = false)
public Item save(Item item)
{
return repo.save(item);
}
create database deadlock_test;
delimiter //
CREATE PROCEDURE `update_mview`(IN `_id` INT)
NO SQL
replace into mview
select
bar.id,
bar.name,
count(*) as num_foo
from
mysql> explain SELECT ... FROM `products` AS `p` WHERE (p.category_id = 91) AND (p.id > 2303852) ORDER BY `p`.`id` ASC LIMIT 10;
+----+-------------+-------+------+------------------------------------+----------------+---------+-------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+------------------------------------+----------------+---------+-------+--------+-------------+
| 1 | SIMPLE | p | ref | PRIMARY,category_id,category_id_id | category_id_id | 4 | const | 610412 | Using where |
+----+-------------+-------+------+------------------------------------+----------------+---------+-------+--------+-------------+
mysql> explain SELECT SQL_NO_CACHE ... FROM `products` AS `p` force index (fooo) WHERE (p.category_id = 91) AND (p.id > 2303852) ORDER BY `p`.`id` ASC LIMIT 10;
+----+-------------+-------+-------+---------------+------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+---------------+------+---------+------+--------+-------------+
| 1 | SIMPLE | p | range | fooo | fooo | 4 | NULL | 985198 | Using where |
+----+-------------+-------+-------+---------------+------+---------+------+--------+-------------+
Aktuelle Implementierung
======================================
Requests zum erzeugen
> POST /item
> {productId:5000, price:1999}
< 201 CREATED
< Location: .../item/1
< {id:1, productId:5000, price:1999}
server {
listen 10.55.1.1:80;
server_name status.rebuy.de;
location ~* /(\d+.\d+.\d+.\d+)-(\d+) {
fastcgi_pass $1:$2;
fastcgi_param REQUEST_URI status.php;
fastcgi_param SCRIPT_NAME status.php;
fastcgi_param PATH_INFO status.php;
fastcgi_param SCRIPT_FILENAME $document_root/status.php;
@dfreudenberger
dfreudenberger / check_fpm.py
Created May 21, 2012 13:18
./check_fpm.py -w 10 -c 20 --hostname='fpm.status.xxx.org' --path='status.php?host=10.55.1.12&port=3000'
#!/usr/bin/python
url = 'http://' + args.hostname + ':' + args.port + '/' + args.path.lstrip('/');
parts = urlparse(url)
qs = parse_qsl(parts.query)
qs.append({'json':'1'})
print urllib.urlencode(qs)