Skip to content

Instantly share code, notes, and snippets.

Avatar
:atom:
Creating awesomeness

Kirill kirugan

:atom:
Creating awesomeness
View GitHub Profile
@kirugan
kirugan / Dockerfile
Created Nov 1, 2020
Dockefile to build thrift compiler
View Dockerfile
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 / kirugan.thrift
Created Nov 1, 2020
my first service specification
View kirugan.thrift
service Kirugan {
void ping();
set<i32> doit();
}
@kirugan
kirugan / great.cpp
Last active Apr 10, 2020
Playing with template for FixedPoint naive implementation
View great.cpp
#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 / main.cpp
Created Apr 9, 2020
Diff between primitive type initialization using new[ ] operator
View main.cpp
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 / tinkoff.go
Created Apr 9, 2020
Small script to analyze payIn and payOut in tinkoff investment
View tinkoff.go
package main
import (
"context"
"fmt"
"math/rand"
"os"
"time"
sdk "github.com/TinkoffCreditSystems/invest-openapi-go-sdk"
@kirugan
kirugan / fast.c
Created Mar 3, 2020
Fast frequency dictionary
View fast.c
#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 / state_machine.go
Created Feb 28, 2020
Interesting implementation of state machine in Golang
View state_machine.go
package main
import "fmt"
type connection struct {
closed bool
usage int
}
type state func(*connection) state
@kirugan
kirugan / restart_goland.sh
Created Feb 21, 2020
Constantly run GoLand ide after exit (useful after trial period expiration)
View restart_goland.sh
#!/bin/bash
while :
do
echo "Starting Goland...";
/Applications/GoLand.app/Contents/MacOS/goland;
done
@kirugan
kirugan / test.c
Created Dec 6, 2019
Free bits in pointers (tested on amazon graviton processors)
View test.c
#include <stdio.h>
#include <stdint.h>
int main() {
int x = 10;
int* y = &x;
printf("Hey! %p (size=%zu)\n", y, sizeof(y));
uint64_t mask = 0;
for (int j = 63; j > 55; j--) {
@kirugan
kirugan / competition.cpp
Last active Oct 11, 2020
Template for competitive programming
View competition.cpp
#include <bits/stdc++.h>
using namespace std;
#define ALL(X) begin(X), end(X)
int main() {
// solution comes here
}
You can’t perform that action at this time.