Skip to content

Instantly share code, notes, and snippets.

@bosko
bosko / mysql-backup.sh
Created April 30, 2016 22:19
Back up all MySQL databases - one file per database
#!/bin/sh
Host=localhost
BDir=~/backup/mysql
read -p "User: " user
read -s -p "Pass: " pass
Dump="/usr/local/bin/mysqldump --skip-extended-insert --force"
MySQL=/usr/local/bin/mysql
In the example solr project when you start it up by calling the following line:
java -jar start
You are starting a Jetty server on your local machine that's going to serve the solr results. This server is not able to do CORS (Cross Origin Resource Sharing). Which means that if you tried to do an AJAX call from a webpage of a different origin than the server itself you would be denied a response.
To fix this you first need to get the apropriate jars to allow for cross-domain resource sharing.
I used the following jar:
http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlets/8.1.10.v20130312/
@bosko
bosko / .pryrc
Created October 3, 2014 05:24
Enabling tabular arrays print with Hirb in Pry
require 'hirb'
Hirb.enable
old_print = Pry.config.print
Pry.config.print = proc do |output, value|
Hirb::View.view_or_page_output(value) || old_print.call(output, value)
end
@bosko
bosko / color-picker
Last active April 26, 2017 04:57 — forked from a3ammar/color-picker
(defun custom-color--choose-action (widget &optional _event) ; this function is only needed if you want to use color-picker in Easy Customization
"customize `widget-color--chose-action' to not split the screen"
(list-colors-display
nil nil
`(lambda (color)
(when (buffer-live-p ,(current-buffer))
(widget-value-set ',(widget-get widget :parent) color)
(pop-to-buffer ,(current-buffer))))))
(defun nscolor2hex (color)
@bosko
bosko / gist:11393247
Created April 29, 2014 07:47
Purchase items regrouping
var purchaseItems = [
{
"id":128449,
"name":"Yellow Banana",
"product_id":103672,
"product_name":"Bananas",
"purchase_date":"2014-02-09 00:00:00",
"dvp_value":5.6,
"nutrient_rate":124.0
@bosko
bosko / README
Created February 5, 2014 09:21 — forked from symposion/README
OSX keychains
These two files should help you to import passwords from mac OS X keychains to 1password.
Assumptions:
1) You have some experience with scripting/are a power-user. These scripts worked for me
but they haven't been extensively tested and if they don't work, you're on your own!
Please read this whole document before starting this process. If any of it seems
incomprehensible/frightening/over your head please do not use these scripts. You will
probably do something Very Bad and I wouldn't want that.
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they
@bosko
bosko / sysctl.conf
Last active December 21, 2015 19:29
Solving problem in connection between Linux VM and Azure SQL.
# This should be placed in /etc/sysctl.conf file so these
# settings are available on system reboot. After change
# execute:
#
# sudo service procps start
#
# To check values execute:
#
# sudo cat /proc/sys/net/ipv4/tcp_keepalive_time
#
@bosko
bosko / gist:3690106
Created September 10, 2012 10:10
Ruby mingw64-32-4.7.1 test failures
sh-3.1$ make test-all
./miniruby.exe -I../../../ruby-git/lib -I. -I.ext/common ../../../ruby-git/tool/runruby.rb --extout=.ext -- --disable-gems "../../../ruby-git/test/runner.rb" --ruby="./miniruby.exe -I../../../ruby-git/lib -I. -I.ext/common ../../../ruby-git/tool/runruby.rb --extout=.ext -- --disable-gems"
d:/projects/ruby/ruby-git/test/cgi/test_cgi_session.rb: 193: %1 is not a valid Win32 application. - d:/projects/ruby/rubyinstaller/sandbox/ruby19_build/.ext/i386-mingw32/digest/md5.so
d:/projects/ruby/ruby-git/test/net/http/test_buffered_io.rb: 193: %1 is not a valid Win32 application. - d:/projects/ruby/rubyinstaller/sandbox/ruby19_build/.ext/i386-mingw32/digest/md5.so
d:/projects/ruby/ruby-git/test/net/http/test_http.rb: 193: %1 is not a valid Win32 application. - d:/projects/ruby/rubyinstaller/sandbox/ruby19_build/.ext/i386-mingw32/digest/md5.so
d:/projects/ruby/ruby-git/test/net/http/test_https.rb:13:in `<class:TestNetHTTPS>': uninitialized constant TestNetHTTPS::TestNetHTTPUtils (NameErro
@bosko
bosko / gist:2994133
Created June 26, 2012 07:33
Ruby 'make test-all' errors with chcp 65001
# Running tests:
[ 611/11297] OpenSSL::TestConfig#test_constants = 0.00 s
1) Failure:
test_constants(OpenSSL::TestConfig) [D:/projects/ruby/ruby-git/test/openssl/test_config.rb:22]:
Exception raised:
<#<Errno::ENOENT: No such file or directory - C:/Users/Luis/Projects/oss/knapsack.old/knap-build/var/knapsack/software/x86-windows/openssl/1.0.0j/ssl/openssl.cnf>>.
[ 3179/11297] TestDir_M17N#test_filename_euc_jp = 0.14 s
2) Failure:
@bosko
bosko / gist:2988529
Created June 25, 2012 13:21
Ruby tests error
D:/projects/ruby/ruby-git/test/syslog/test_syslog_logger.rb: cannot load such file -- syslog/logger (LoadError)
D:/projects/ruby/ruby-git/lib/test/unit.rb:534:in `load': undefined class/module WIN32OLERuntimeError (ArgumentError)
from D:/projects/ruby/ruby-git/lib/test/unit.rb:534:in `block in _run_parallel'
from D:/projects/ruby/ruby-git/lib/test/unit.rb:503:in `each'
from D:/projects/ruby/ruby-git/lib/test/unit.rb:503:in `_run_parallel'
from D:/projects/ruby/ruby-git/lib/test/unit.rb:651:in `_run_suites'
from D:/projects/ruby/ruby-git/lib/minitest/unit.rb:792:in `_run_anything'
from D:/projects/ruby/ruby-git/lib/minitest/unit.rb:981:in `run_tests'
from D:/projects/ruby/ruby-git/lib/minitest/unit.rb:968:in `block in _run'