Install apache + passenger
https://www.phusionpassenger.com/library/install/apache/install/oss/xenial/
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
int n = 3; | |
int m = 3; | |
int a[3][3] = { 0 }; | |
a[1][1] = 5; | |
int x = 5; |
def measure(no_gc = true, &block) | |
if no_gc | |
GC.disable | |
else | |
GC.start | |
end | |
memory_before = `ps -o rss= -p #{Process.pid}`.to_i/1024 | |
gc_stat_before = GC.stat | |
time = Benchmark.realtime do | |
yield |
#!/bin/sh | |
# store start date to a variable | |
imeron=`date` | |
echo "Import started: OK" | |
dumpfile="/home/bob/bobiras.sql" | |
ddl="set names utf8; " | |
ddl="$ddl set global net_buffer_length=1000000;" |
https://www.phusionpassenger.com/library/install/apache/install/oss/xenial/
sizes = [10, 50, 100, 1000] | |
sizes.each do |size| | |
array = size.times.map { |i| rand(size) } | |
threshold = size / 2 | |
Benchmark.bmbm(2) do |x| | |
x.report("select #{size}") do | |
array.select { |item| item > threshold } | |
.each { |item| item * item } |
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
filename = 'flowdata_201803052230.sql' | |
INSERT_MATCHER = 'INSERT INTO' | |
file = 1 | |
counter = 1 | |
File.open(filename, 'r').each do |line| | |
next unless line.include? INSERT_MATCHER | |
File.open(file.to_s + '.sql', 'a+') { |file| file.write("\n" + line) } |
sudo apt-get install build-essential texinfo libx11-dev libxpm-dev libjpeg-dev libpng-dev libgif-dev libtiff-dev libgtk2.0-dev libncurses-dev libxpm-dev automake autoconf
mkdir emacs
cd emacs
class A | |
protected | |
def protected_a | |
puts "Protected A" | |
end | |
private | |
def private_a | |
puts "Private A" | |
end |
Active record
hoặc Arel
over raw queries
Example:
# unless ids.blank?
# sql = "DELETE FROM links WHERE links.user_id = #{user_id.to_s} AND links.id IN (#{ids.to_s})"
# connection.execute(sql)
# end
return if ids.blank?