Skip to content

Instantly share code, notes, and snippets.

@bosko
bosko / Swin.livemd
Last active August 16, 2024 12:08
Swin example

Swin experiments

Mix.install([
  {:bumblebee, path: "/Users/bosko/Code/elixir/bumblebee"},
  {:nx, "~> 0.7.2"},
  {:exla, "~> 0.7.2"},
  {:kino, "~> 0.12.3"},
  {:stb_image, "~> 0.6.8"},
  {:req, "~> 0.5.0"}
@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
@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 / 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'
@bosko
bosko / calendar.rb
Created February 7, 2012 21:51
API v3 snippets
require 'google_suite/oauth/calendar_oauth'
require 'google_suite/oauth/calendar_oauth2'
class Calendar < Scope
# At this moment we must know what is version of API
# that we are created for. In other words client must already
# be created before any of "data" classes are used
case GoogleSuite.client.api_version
when "2.0"
include(GoogleSuite::CalendarOAuth)