Skip to content

Instantly share code, notes, and snippets.

View kika's full-sized avatar

Kirill Pertsev kika

View GitHub Profile
module TCO where
import Prelude
import Data.Either
import Control.Monad.Rec.Class
isEven::Int -> Boolean
isEven = tailRec (either isEven' isOdd') <<< Left
@kika
kika / backup_brew.sh
Last active November 22, 2016 03:25 — forked from donkaban/backup_brew.sh
#!/bin/bash
echo '#!/bin/bash'
echo ''
echo 'failed_items=""'
echo 'function install_package() {'
echo 'echo EXECUTING: brew install $1 $2'
echo 'brew install $1 $2'
echo '[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install.'
echo '}'
@kika
kika / keybase.md
Last active October 16, 2017 17:52

Keybase proof

I hereby claim:

  • I am kika on github.
  • I am kika (https://keybase.io/kika) on keybase.
  • I have a public key ASCjlH4m62ubWjf68rIp4m0vLJxP5eOP-aAqdik4q_fxKgo

To claim this, I am signing this object:

@kika
kika / userdata.sh
Created December 19, 2017 19:23 — forked from brantburnett/userdata.sh
Couchbase EC2 NVMe Userdata Script
#!/bin/bash
# Include as user data during instance startup, or run as root using sudo
# Assumes that you are using an i3 instance type with NVMe instance storage attached
# Set swappiness to zero
sysctl vm.swappiness=0
echo "vm.swappiness = 0" >> /etc/sysctl.conf
# Disable transparent huge pages
cat > /etc/init.d/disable-thp <<- 'EOM'
newtype A = A {
properties :: StrMap B
}
newtype B = B {
first :: String,
last :: String,
ssn :: String
}
@kika
kika / progress.sh
Last active December 29, 2018 03:44
Calculate daily progress in lines of code from git repo and generate csv file.
#!/bin/bash
DATE=gdate
set -euo pipefail
if [[ "${1:-}" == "" || "${2:-}" == "" ]]; then
echo "Usage: $0 <start date> <directory with source> [optional cloc args]"
exit 1
fi
@kika
kika / flutter.vim
Created February 4, 2019 02:59
Flutter classes and types for Vim syntax highlighting in Dart. Add this to your `.vimrc`
augroup fl_dart
autocmd!
autocmd Syntax dart highlight default link dartFlutterClasses Type
autocmd Syntax dart highlight default link dartFlutterTypedefs Typedef
autocmd Syntax dart highlight default link dartFlutterExceptions Exception
autocmd Syntax dart highlight default link dartFlutterConstants Constant
autocmd Syntax dart highlight default link dartFlutterEnums Type
autocmd Syntax dart highlight default link dartFlutterMixins Type
autocmd Syntax dart syntax keyword dartFlutterMixins
\ AnimationEagerListenerMixin AnimationLazyListenerMixin
@kika
kika / antiantialias.sh
Last active February 26, 2025 10:34
Keep VS Code UI font antialiased when the editor window has the antialias turned off
# MacOS only
# This script modifies one VS Code file. After that the VS Code will complain that the installation is damaged.
# You can dismiss the warning or install an extension that recalculates the checksums for the files
# The script creates a backup for the CSS file it modifies
perl -i.bak -pe 's/\.monaco-workbench.mac.monaco-font-aliasing-none{-webkit-font-smoothing:none/.monaco-workbench.mac.monaco-font-aliasing-none{-webkit-font-smoothing:antialiased/g' \
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.css
@kika
kika / main.dart
Created July 29, 2019 04:34
Create flutter project with `flutter create` and replace the source file with this
import 'package:flutter/material.dart';
class MyKeys {
static final GlobalKey navKey = GlobalKey<NavigatorState>(debugLabel: 'navKey');
}
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
double kHeight = 100;
double kWidth = 100;
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {