This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DockerFile | |
FROM php:5.6-cli | |
# Install Composer | |
COPY --from=composer /usr/bin/composer /usr/bin/composer | |
#RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
RUN apt-get -qq update && apt-get -qq install mysql-client python3 libxml++2.6-dev > /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Get hostname | |
shell: echo $HOSTNAME | |
register: local_hostname | |
delegate_to: localhost | |
- name: Get current user | |
shell: whoami | |
register: local_user | |
delegate_to: localhost |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getReadableFileSizeString(fileSizeInBytes) { | |
var i = -1; | |
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB']; | |
do { | |
fileSizeInBytes = fileSizeInBytes / 1024; | |
i++; | |
} while (fileSizeInBytes > 1024); | |
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i]; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro form_field(field) -%} | |
{% set with_label = kwargs.pop('with_label', False) %} | |
{% set placeholder = '' %} | |
{% if not with_label %} | |
{% set placeholder = field.label.text %} | |
{% endif %} | |
<div class="control-group {% if field.errors %}error{% endif %}"> | |
{% if with_label %} | |
<label for="{{ field.id }}" class="control-label"> | |
{{ field.label.text }}{% if field.flags.required %} *{% endif %}: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from flask import Flask, request | |
app = Flask(__name__) | |
app.testing = True | |
@app.route('/action') | |
def action(): | |
return "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModel | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
field :value, :type => String | |
index :value, :unique => true | |
attr_accessible :value | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Wed 14-32-41_user-jeremy-dai-334314.custom_stylesheet.e7d5.txt */ | |
#bd .last_feedbacks_widget div.feedback div.metadata dl.vote dd.controls li.score-control-plus {left:3px;} | |
#bd .last_feedbacks_widget div.feedback, | |
#bd .most_consulted_feedbacks_widget div.feedback {margin-bottom:30px;height:200px;} | |
#bd .small ul.feedbacks li.feedback, #bd div.sliding_panel ul.feedbacks li.feedback {margin-bottom:0;} | |
.link-to-feedback {display:none;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Log all slow Rails queries | |
grep -E -i "Load|Update|SQL|COUNT" answers.log | grep -E '\([2-9][0-9]{3,}\.[0-9]*ms\)' | sed 's/.*(\([0-9]*\)\.[0-9]*ms)/\1/g' > /home/vlad/profiling/slow_answers_queries.sql | |
grep -E -i "Load|Update|SQL|COUNT" auth.log | grep -E '\([1-9][0-9]{3,}\.[0-9]*ms\)' | sed 's/.*(\([0-9]*\)\.[0-9]*ms)/\1/g' > /home/vlad/profiling/slow_auth_queries.sql | |
## Ideas app | |
# test normal download | |
curl "https://domain-test.ideas.dimelo.com" --silent --silent --write-out "size_download=%{size_download}\n" --output /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Total size of data + indexes for *ALL* DBs | |
SELECT table_schema "DB Name", ROUND(SUM(data_length) / 1024 / 1024, 2) "Data size (MB)", ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) | |
"Data + Indexes size (MB)" FROM information_schema.TABLES GROUP BY table_schema ; | |
# Total size of data + indexes for *ALL* Tables in a DB | |
SELECT TABLE_NAME, table_rows, data_length, index_length, round(((data_length + index_length) / 1024 / 1024),2) "Total size (MB)" | |
FROM information_schema.TABLES WHERE table_schema = "db_name"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bug report: http://www.ruby-forum.com/topic/208026 | |
# | |
## Reproduce bug | |
require 'socket' | |
require 'openssl' # Should return true | |
s = TCPSocket.new 'bugzilla.redhat.com', 443 | |
ctx = OpenSSL::SSL::SSLContext.new |
NewerOlder