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
export TIME="====== Time report\ncommand: %C\nreal: %E\nuser: %U\nsys: %S\nFilesystem inputs: %I\nAverage memory usage: %Mk\nAverage CPU usage: %P\n======" |
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
print_trace = fn(print_trace, fd) -> | |
receive do | |
msg -> | |
:io.format(fd, "call: (tracer pid: ~p)~n ~p~n", [self(), msg]) | |
print_trace.(print_trace, fd) | |
end | |
end | |
{ok, fd} = :file.open("/tmp/trace.out", [:write]) | |
custom_tracer = :proc_lib.spawn(fn -> print_trace.(print_trace, fd) 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
#!/bin/bash | |
FILES=*.srt | |
for f in $FILES | |
do | |
echo "Processing $f file..." | |
iconv -c -f WINDOWS-1251 -t UTF-8 "$f" -o "$f" | |
done |
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
FROM ubuntu | |
RUN apt-get update -qq | |
RUN apt-get install -y sbcl | |
RUN apt-get install -y build-essential curl | |
RUN curl -O https://beta.quicklisp.org/quicklisp.lisp | |
RUN sbcl --load quicklisp.lisp --eval '(quicklisp-quickstart:install)' | |
RUN mkdir -p /app/ |
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
docker_compose_exec() { | |
docker exec -it $(docker-compose ps | grep $1 | awk '{print $1}') ${@:2} | |
} | |
alias dcrun='docker_compose_exec web' | |
alias dcenter='docker_compose_exec web bash' | |
alias dcenter_new='docker-compose run web bash' # if container is not up |
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
# Write your default config options here! | |
## outputs | |
# ao=alsa:device=hw=3.0 | |
# ao=pulse | |
# vo=fbdev2 | |
## screen | |
monitoraspect="16:9" | |
stop-xscreensaver="yes" |
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
# Fix CarrierWave to work with filenames (not files) | |
module CarrierWave::Uploader::Cache | |
def cache!(filename) | |
@file = CarrierWave::SanitizedFile.new(File.open(filename)) | |
@filename = filename | |
end | |
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
class PaymentInput < SimpleForm::Inputs::Base | |
def input(wrapper_options) | |
custom_input_options = { value: value, maxlength: 16 } | |
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options) | |
merged_input_options = merge_wrapper_options(custom_input_options, merged_input_options) | |
@builder.text_field(attribute_name, merged_input_options) | |
end | |
def value | |
before_type_cast_value = object.send("#{attribute_name}_money_before_type_cast") |
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
# most hungry processes (no, htop is too mainstream) | |
ps aux --sort -rss | head -n 10 | sed 's/[^ ]* *[0-9]* *\([0-9\.]*\) *\([0-9\.]*\) *[0-9]* *[0-9]* *? *[SsLl]* *[^ ]* *[^ ]* *\([^ ]*\).*/processor: \1%, memory: \2%, process: \3/' | |
# fix unzipped files with russian names in current directory | |
find . -type f -exec sh -c 'np=`echo {}|iconv -f cp1252 -t cp850| iconv -f cp866`; mv "{}" "$np"' \; |
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
db: | |
image: postgres | |
ports: | |
- "5432" | |
mailcatcher: | |
image: simpledrupalcloud/mailcatcher:latest | |
hostname: mailcatcher | |
ports: | |
- "1080:1080" |