Skip to content

Instantly share code, notes, and snippets.

View DimaSamodurov's full-sized avatar
🇺🇦
Stand With Ukraine

Dmytro Samodurov DimaSamodurov

🇺🇦
Stand With Ukraine
  • EPAM
  • Lviv, Ukraine
View GitHub Profile
@DimaSamodurov
DimaSamodurov / untrusted_packages.sh
Created December 27, 2011 13:56
How to Fix ‘Requires installation of untrusted packages’ error in Ubuntu
$sudo apt-get update
#notice line like: "The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive.."
#install public key above
$sudo apt-key adv --recv-key --keyserver keyserver.ubuntu.com 40976EAF437D05B5
#thanks to: http://www.liberiangeek.net/2010/10/fix-requires-installation-untrusted-packages-error-ubuntu-10-10-maverick-meerkat/
def distance(str1, str2)
str1.downcase!
pairs1 = (0..str1.length-2).collect {|i| str1[i,2]}.reject {
|pair| pair.include? " "}
str2.downcase!
pairs2 = (0..str2.length-2).collect {|i| str2[i,2]}.reject {
|pair| pair.include? " "}
union = pairs1.size + pairs2.size
intersection = 0
pairs1.each do |p1|
@DimaSamodurov
DimaSamodurov / capybara-firefox5-test.rb
Created July 7, 2011 15:58
Check if Capybara opens firefox
# coding: utf-8
# Upgrading ruby or firefox selenium tests stopped working.
# Use selenium-webdriver >= 0.2.2 with ruby 1.9.2 and Firefox 5.
require "rubygems"
require "capybara/dsl"
class Test
include Capybara::DSL