Skip to content

Instantly share code, notes, and snippets.

View kirugan's full-sized avatar
:atom:
Creating awesomeness

Kirill kirugan

:atom:
Creating awesomeness
View GitHub Profile
@kirugan
kirugan / restart_goland.sh
Created February 21, 2020 14:49
Constantly run GoLand ide after exit (useful after trial period expiration)
#!/bin/bash
while :
do
echo "Starting Goland...";
/Applications/GoLand.app/Contents/MacOS/goland;
done
@kirugan
kirugan / state_machine.go
Created February 28, 2020 10:21
Interesting implementation of state machine in Golang
package main
import "fmt"
type connection struct {
closed bool
usage int
}
type state func(*connection) state
@kirugan
kirugan / fast.c
Created March 3, 2020 08:48
Fast frequency dictionary
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <sys/mman.h>
typedef struct freq {
int freq;
char* word;
@kirugan
kirugan / tinkoff.go
Created April 9, 2020 15:19
Small script to analyze payIn and payOut in tinkoff investment
package main
import (
"context"
"fmt"
"math/rand"
"os"
"time"
sdk "github.com/TinkoffCreditSystems/invest-openapi-go-sdk"
@kirugan
kirugan / main.cpp
Created April 9, 2020 18:52
Diff between primitive type initialization using new[ ] operator
int main() {
auto a = new int[1000];
a[500] = 33;
auto b = new(a) int[1000];
std::cout << b[500] << std::endl;
return 0;
}
@kirugan
kirugan / great.cpp
Last active April 10, 2020 11:05
Playing with template for FixedPoint naive implementation
#include <iostream>
template<std::size_t T>
struct FixedPoint {
static constexpr int Size = T;
int value;
static_assert(Size < sizeof(value) * 8);
};
constexpr FixedPoint test(double d) {
@kirugan
kirugan / competition.cpp
Last active October 11, 2020 20:39
Template for competitive programming
#include <bits/stdc++.h>
using namespace std;
#define ALL(X) begin(X), end(X)
int main() {
// solution comes here
}
@kirugan
kirugan / kirugan.thrift
Created November 1, 2020 14:25
my first service specification
service Kirugan {
void ping();
set<i32> doit();
}
@kirugan
kirugan / Dockerfile
Created November 1, 2020 15:00
Dockefile to build thrift compiler
FROM ubuntu
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y curl git php python php-xml libtool m4 automake pkg-config g++ make
# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('sha384', 'composer-setup.php') === 'c31c1e292ad7be5f49291169c0ac8f683499edddcfd4e42232982d0fd193004208a58ff6f353fde0012d35fdd72bc394') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
@kirugan
kirugan / .vimrc
Created December 19, 2020 20:27
My vimrc file
set hlsearch " highlight all search results
set ignorecase " do case insensitive search
set incsearch " show incremental search results as you type
set number " display line number
set noswapfile " disable swap file ???