Skip to content

Instantly share code, notes, and snippets.

View denyago's full-sized avatar
🤠

Denys Yahofarov denyago

🤠
View GitHub Profile
@denyago
denyago / CoroutinesVsLoom.kt
Created October 17, 2024 12:41
Comparison of Coroutine-based and JVM Virtual Thread -based approaches to building parallel running tasks.
package com.finmid
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import java.time.Instant
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.Future
import java.util.concurrent.FutureTask
@denyago
denyago / hash-array-set-lookup.rb
Last active September 19, 2016 11:47
Compare speed of key lookup using Hash, Set and Array.
require "benchmark/ips"
require "benchmark/memory"
require "set"
SIZE = 50
def mk_key(i)
"key-#{i}"
end
@denyago
denyago / README.md
Last active April 12, 2021 11:52
Screencast from Android

Screancasting from Android

There are 2 ways to capture video streams, but both have the same source adb shell screenrecord.

Important: device must be POWERFULL!

This will use "Raw frames". It can wait for user to continue

adb shell screenrecord --size=360x640 --output-format=raw-frames - | mplayer -demuxer rawvideo -rawvideo w=360:h=640:format=rgb24 -

Keybase proof

I hereby claim:

  • I am denyago on github.
  • I am denyago (https://keybase.io/denyago) on keybase.
  • I have a public key whose fingerprint is 99BC 63B5 8267 CEF2 F293 E409 6CDA 082D FE39 D507

To claim this, I am signing this object:

\set QUIET 1
-- formatting
\x auto
\set VERBOSITY verbose
\set ON_ERROR_ROLLBACK interactive
-- show execution times
\timing
-- limit paging
\pset pager off
mysql.server start --log-error=/tmp/mysql.errors.log &&\
watch -c -n 20 'mysql.server status; echo "\n"; tail -n 20 /tmp/mysql.errors.log' ;\
mysql.server stop
Capybara.register_driver :en_browser do |app|
require 'selenium-webdriver'
Selenium::WebDriver::Firefox::Binary.path = '/Users/di/Applications/Firefox.app/Contents/MacOS/firefox-bin'
profile = Selenium::WebDriver::Firefox::Profile.new
profile['intl.accept_languages'] = 'en'
Capybara::Selenium::Driver.new(app, {:browser => :firefox, :profile => profile})
end
@denyago
denyago / perf.rb
Last active August 29, 2015 14:20
Ruby profiling
# gem 'ruby-prof'
module WithProfiling
def self.run
RubyProf.start
puts 'Start'
result = yield
require 'diff_matcher'
RSpec::Matchers.define :be_matching do |expected|
match do |actual|
@difference = DiffMatcher::Difference.new(normalize(expected), normalize(actual), opts)
no_errors_happened? && @difference.matching?
end
failure_message do |actual|
no_errors_happened? ? @difference.to_s : "Critical errors during matching:\n#{errors.join("\n")}"

My pi runs a raspbian distro (2013-09-25-wheezy-raspbian.zip)

Java

What the raspberry page officially recommends is the jdk. (Source: http://www.raspberrypi.org/archives/4920).

sudo apt-get update && sudo apt-get install oracle-java7-jdk

However, this doesn't include a server on the pi. The jre needs to be installed instead.