Skip to content

Instantly share code, notes, and snippets.

View acosonic's full-sized avatar
💭
I may be slow to respond.

Aleksandar Pavić acosonic

💭
I may be slow to respond.
View GitHub Profile
$conditons = array();
if (empty($status)) {
$status = 'NULL';
}
if (empty($from)) {
$from = 'NULL';
}
if (empty($to)) {
#image_url = url_for :only_path => false, :controller => 'account', :action => 'get_avatar', :id => user
options[:size] = "64" unless options[:size]
image_url = "https://example.com/users/" + user.login
return "<img class=\"gravatar\" width=\"#{options[:size]}\" height=\"#{options[:size]}\" src=\"#{image_url}\" />".html_safe
# = Redmine configuration file
#
# Each environment has it's own configuration options. If you are only
# running in production, only the production block needs to be configured.
# Environment specific configuration options override the default ones.
#
# Note that this file needs to be a valid YAML file.
# DO NOT USE TABS! Use 2 spaces instead of tabs for identation.
# default configuration options for all environments
Started GET "/projects" for 94.247.200.2 at 2016-05-10 11:39:05 +0200
Processing by ProjectsController#index as HTML
Current user: admin (id=1)
Rendered projects/index.html.erb within layouts/base (8.8ms)
Completed 200 OK in 27ms (Views: 16.6ms | ActiveRecord: 4.3ms)
Started GET "/projects/sla_project-1" for 94.247.200.2 at 2016-05-10 11:39:06 +0200
Processing by ProjectsController#show as HTML
Parameters: {"id"=>"sla_project-1"}
Current user: admin (id=1)
Rendered projects/_members_box.html.erb (0.4ms)
@acosonic
acosonic / disk_speed.txt
Last active June 4, 2024 16:35
Testing of diskspeed at various hosting companies on idle machines
Command used for testing:
dd if=/dev/zero of=sb-io-test bs=1M count=1k conv=fdatasync && rm sb-io-test
Results sorted by best->top / worst->bottom
Herzner (1 cpu cloud machine)
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 1.23958 s, 866 MB/s
OVH Dedicated VmWare nVME
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 1.24378 s, 863 MB/s
root@server:~# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=
LANGUAGE=
LC_CTYPE=UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
@acosonic
acosonic / redmine.1.log
Last active November 15, 2016 13:58
Captured web server hack attempt via Nginx and Redmine, full ngnix access log dump
46.172.91.20 - - [08/Nov/2016:05:28:26 -0500] "GET / HTTP/1.1" 200 3946 "-" "Scanbot"
179.43.141.241 - - [08/Nov/2016:15:23:54 -0500] "GET //phpMyAdmin/scripts/setup.php HTTP/1.1" 404 344 "-" "-"
179.43.141.241 - - [08/Nov/2016:15:23:55 -0500] "GET //phpmyadmin/scripts/setup.php HTTP/1.1" 404 344 "-" "-"
179.43.141.241 - - [08/Nov/2016:15:23:57 -0500] "GET //myadmin/scripts/setup.php HTTP/1.1" 404 344 "-" "-"
141.212.122.16 - - [09/Nov/2016:01:30:30 -0500] "GET / HTTP/1.1" 200 1640 "-" "Mozilla/5.0 zgrab/0.x"
209.234.166.132 - - [09/Nov/2016:03:18:24 -0500] "GET / HTTP/1.1" 200 3946 "-" "Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0"
189.219.168.65 - - [09/Nov/2016:03:51:42 -0500] "GET /cgi/common.cgi HTTP/1.0" 404 459 "-" "Wget(linux)"
189.219.168.65 - - [09/Nov/2016:03:51:43 -0500] "GET /stssys.htm HTTP/1.0" 404 459 "-" "Wget(linux)"
189.219.168.65 - - [09/Nov/2016:03:51:43 -0500] "GET / HTTP/1.0" 200 3946 "-" "Wget(linux)"
189.219.168.65 - - [09/Nov/2016:03:51:44 -0500] "POST /command.p
@acosonic
acosonic / ruby_erb.xml
Created January 5, 2017 12:26
Notepad++ Custom syntax highlighting for Ruby erb
<NotepadPlus>
<UserLang name=“ERB” ext=".rhtml" udlVersion=“2.1”>
<Settings>
<Global caseIgnored=“no” allowFoldOfComments=“no” foldCompact=“no” forcePureLC=“2” decimalSeparator=“0” />
<Prefix Keywords1=“no” Keywords2=“no” Keywords3=“no” Keywords4=“no” Keywords5=“no” Keywords6=“no” Keywords7=“no” Keywords8=“no” />
</Settings>
<KeywordLists>
<Keywords name=“Comments”>00# 01 02 03<!-- 04–></Keywords>
<Keywords name=“Numbers, prefix1”></Keywords>
<Keywords name=“Numbers, prefix2”></Keywords>
@acosonic
acosonic / pre-commit
Last active October 18, 2017 13:03
Svn pre-commit hook requiring Redmine's issue id to be referenced with # as described in Redmine Cookbook a book by Packt Publishing
#!/bin/sh
# This script requires you to have svnlook installed (update it's location on line 5, if required...)
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
LOGMSG=$($SVNLOOK log -t "$TXN" "$REPOS" | grep -e "refs #" -e "production" | wc -c)
if [ "$LOGMSG" -le 0 ]; then echo "Valid comments needs to have refs #issueID." 1>&2
exit 1
fi
# Exit on all errors.
@acosonic
acosonic / .htaccess
Created October 23, 2017 11:01
Apache mod_rewrite .htaccess rule for CakePHP to force HTTPS, but ensure Letsencrypt renew works automatically thru virtualmin
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^.well-known/ - [L,NC]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]