Skip to content

Instantly share code, notes, and snippets.


Kyriakos Chatzidimitriou kyrcha

View GitHub Profile
kyrcha /
Created Jun 16, 2020
Calculating lines of code for my React+Node projects with cloc
cloc --fullpath --not-match-d='(node_modules|build|static|coverage|__tests__|tests)' --exclude-list-file=notcount .
kyrcha /
Created Jun 10, 2020
Update outdated global npm packages
  1. Check which global packages are outdated with:

npm outdated -g

For example:

  1. Update the pacakges:
kyrcha /
Last active Apr 11, 2020
Confirm your Anaconda ML environment
# Idea from:
# scipy
import scipy
print('scipy: %s' % scipy.__version__)
# numpy
import numpy
print('numpy: %s' % numpy.__version__)
# matplotlib
import matplotlib
kyrcha / websites.controller.ts
Created Mar 31, 2020
Really simple example of a website builder with NestJS, 11ty and nginx - websites.controller.ts
View websites.controller.ts
import { Controller, Post, Body, Get, UseInterceptors, UploadedFile } from '@nestjs/common';
import { CreateWebsiteDto } from './dto/create-website.dto';
import { FileInterceptor } from '@nestjs/platform-express';
import {existsSync, mkdirSync, writeFileSync} from 'fs';
import { randomBytes } from 'crypto';
import { join } from 'path';
import { copySync } from 'fs-extra';
import { exec, pwd } from 'shelljs';
import * as rimraf from 'rimraf';
kyrcha /
Last active Nov 27, 2019
AuthEceSoftEng approach to CodRep-2019 competition

AuthEceSoftEng <> CodRep-2019

The Problem

The goal of the CodRep 2019 competition was to predict formatting errors in source code.

We were given 8000 Java files with one formatting error in each one and another file (out.txt) that contained the character position the formatting error existed. For example, in the snippet below, the error (unnecessary space) is found in position 30:

kyrcha / graphqlclient.go
Last active Oct 14, 2019
Performing GraphQL queries (to GiHub) using the barebones http.Client in Go
View graphqlclient.go
package main
import (
kyrcha /
Created Jul 16, 2019
Converting a pandas dataframe with each row being a vector image to a 4D tensor for CNN use in Keras
# Transforming a 60000x784 dataframe to a 60000x28x28x1 4D tensor for Keras modelling
train_img = X_train.values.reshape(X_train.shape[0], 28, 28, 1)
kyrcha / zipballs-downloader.js
Last active Jun 11, 2019
Downloading tarballs (or zipballs) using JavaScript async/await, the `Get archive link` of the GitHub Contents API, the octokit/rest.js client and the request library
View zipballs-downloader.js
const Octokit = require('@octokit/rest')
const rp = require('request-promise')
const fs = require('fs')
function sleep (ms) {
return new Promise(resolve => setTimeout(resolve, ms))
const baseUrl = ''
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN })
kyrcha / .editorconfig
Created Apr 12, 2019
My editor config file for Visual Studio Code. Put it in the root of your project. Go to the preferences of VSC > Keyboard Shortcuts. Search for document format shorcut. Open a file. Use that shorcut and your document should be formatted.
View .editorconfig
root = true
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
kyrcha /
Last active Jul 7, 2020
Calculate the running average and standard deviation using redis transactions (pipelines in python-redis) and multiple python threads. You can quickly test it by installing a dockerized redis.
from multiprocessing import Pool
import redis
import math
import json
from random import seed
from random import gauss
# Atomic operations
def sum(x):
r = redis.Redis(host='localhost', port=6379, db=0)
You can’t perform that action at this time.