Skip to content

Instantly share code, notes, and snippets.

View kika's full-sized avatar

Kirill Pertsev kika

View GitHub Profile
@kika
kika / notifier.rs
Created August 16, 2023 15:48
Classificados Online Email Notifier
use select::document::Document;
use select::predicate::Class;
use serde_json::json;
use worker::*;
mod utils;
struct ParseError(String);
impl std::fmt::Display for ParseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@kika
kika / main-noasync.dart
Last active August 2, 2022 20:04
resonating-destiny-0416
import 'dart:html';
void main() {
wsAPI()
.then((_) => print('Great success!'))
.catchError((_) => print('Miserable failure'));
}
Future<void> wsAPI() async {
try {
@kika
kika / main.dart
Created August 2, 2022 19:58
resonating-destiny-0416
import 'dart:html';
void main() async {
try {
final socket = await wsConnect('wss://127.0.0.1:7654');
print('${socket.readyState}');
} catch (e) {print(e);}
}
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
double kHeight = 100;
double kWidth = 100;
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@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.
@kika
kika / antiantialias.sh
Last active July 8, 2022 17:05
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 / 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 / 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
newtype A = A {
properties :: StrMap B
}
newtype B = B {
first :: String,
last :: String,
ssn :: String
}
@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'