Skip to content

Instantly share code, notes, and snippets.

Stanislav zbstof

View GitHub Profile
View Broken hashset key.java
public static void main(String[] args) {
Set<Student> set = new HashSet<Student>();
Student s = new Student("Маша", "Иванова");
set.add(s);
s.setName("Даша");
set.add(s);
System.out.println(set.size());
}
class Student{
View zip.scala
import scala.collection.mutable.ArrayBuffer
def merge1Immutable(ls: Array[Char]): Array[Char] = {
if (ls.isEmpty) ls
else {
var size = 1
var globalCh: Char = ls.head
val resLs = ArrayBuffer[Char]()
for (i <- 1 until ls.length) {
val ch: Char = ls(i)
@zbstof
zbstof / macos.sh
Last active Sep 12, 2018
Setup new Mac quickly
View macos.sh
####### Set Up ########
# From https://github.com/mathiasbynens/dotfiles/blob/master/.macos :
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
View remap.sh
#!/usr/bin/env bash
# To run at startup:
# sudo defaults write com.apple.loginwindow LoginHook `pwd`/remap.sh
# https://developer.apple.com/library/content/technotes/tn2450/_index.html
CAPS_LOCK="0x700000039"
ESCAPE="0x700000029"
NON_US_BACKSLASH_PLUS_MINUS="0x700000064"
GRAVE_ACCENT_AND_TILDE="0x700000035"
SLASH_PIPE="0x700000031"
ENTER_RETURN="0x700000028"
@zbstof
zbstof / Ukrainian.keylayout
Last active Oct 26, 2018
Ukrainian keyboard for MacOS, that works just like standard Windows Ukrainian keyboard - '.' and ',' in bottom right, '?' on Shift+7, ':' on Shift+4, ';' on Shift+6. Install with Ukelele for current user. You will need Ukelele to import this file `brew cask install ukelele`
View Ukrainian.keylayout
<?xml version="1.1" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!--Last edited by Ukelele version 3.2.7.195 on 2017-11-17 at 18:42 (GMT+2)-->
<keyboard group="126" id="-6049" name="Ukrainian" maxout="1">
<layouts>
<layout first="0" last="0" mapSet="138" modifiers="30"/>
</layouts>
<modifierMap id="30" defaultIndex="5">
<keyMapSelect mapIndex="0">
<modifier keys="option command? control"/>
View euler19
m1 = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
m2 = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
mon_sy = {
1: "January", 2: "February", 3: "March", 4: "April", 5: "May", 6: "June",
7: "July", 8: "August", 9: "September", 10: "October", 11: "November",
12: "December"}
leap = [year for year in range(1904, 2001, 4)]
def months():
View .vimrc
"Vim, not vi set nocompatible
"sets the language of the menu (gvim)
set langmenu=en_US.UTF-8
"sets the language of the messages / ui (Vim)
language messages en
"Remove ALL autocommands for the current group
autocmd!
"automatically use system clipboard
set clipboard=unnamed
"Disable cursor blinking
You can’t perform that action at this time.