Skip to content

Instantly share code, notes, and snippets.

View gonaumov's full-sized avatar
💭
a status

George Naumov gonaumov

💭
a status
View GitHub Profile
@gonaumov
gonaumov / Main.kt
Created May 1, 2022 10:25
Kotlin sequences demo from a JetBrains tiny task
/**
* I am using this task to make a demonstration about Kotlin sequences.
* @author Georgi Naumov
* [email protected] for contacts and suggestions.
*/
const val INPUT_SIZE = 5
fun readSequence(iteration: Int): Sequence<String> {
var count = iteration
return generateSequence {
@gonaumov
gonaumov / Main.kt
Created April 25, 2022 22:21
Russian roulette with Kotlin
package com.company
fun main() {
for ((index, shot) in BooleanArray(6) { false }.apply {
this[(0 until this.size).random()] = true
this.shuffle()
}.withIndex()) {
if (shot) {
println("Iteration ${index + 1}. You are dead ..")
break
awk -F "," '{print "INSERT INTO table_name(\"first_field\",\"second_field\") VALUES('\''"$1"'\'','\''"$2"'\'') ON CONFLICT DO NOTHING;"}' CSVFileNAme.csv > V1.22_migration_name.sql
@gonaumov
gonaumov / useCookie.js
Created February 17, 2022 15:37 — forked from lwkchan/useCookie.js
Simple React hook to get/set Cookies with 'universal-cookie' package 🍪
import {useState} from 'react';
import Cookies from 'universal-cookie';
const useCookie = (key, options = {}) => {
const cookies = new Cookies();
const [item, setItemValue] = useState(() => {
if (cookies.get(key)) {
return cookies.get(key);
}
return null;
/**
* Let's make a program that accepts a matrix and if
* the elements below the main diagonal are less than
* zero replace them with zero ...
*/
fun main() {
"""
1 2 -1
-1 -1 6
-1 -1 9
package com.example.uniformcivilnumber
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.example.uniformcivilnumber.databinding.ActivityResultBinding
class ResultActivity : AppCompatActivity() {
private lateinit var binding: ActivityResultBinding
/**
* Merry Christmas from Kotlin
*/
fun main() {
println(
arrayOf(
"M",
"rr",
"Chr",
"stm",
@gonaumov
gonaumov / scrape.user.js
Last active December 18, 2021 17:00
A tiny data scrapper wich I wrote to get some needed data ...
/**
* This tiny script extracts data from:
* https://occultthings.wordpress.com/2012/09/07/%D0%B3%D0%B0%D0%B4%D0%B0%D0%B5%D0%BD%D0%B5-%D1%81-%D0%BA%D0%B0%D1%80%D1%82%D0%B8-%D0%B7%D0%B0-%D0%B8%D0%B3%D1%80%D0%B0-%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5-%D0%BD%D0%B0-%D0%BA%D0%B0%D1%80/
* created json array and download it.
**/
(function() {
const cards = document.body.textContent.split("Асо").splice(1)
const results = [];
cards.forEach((item) => {
const toHandle = `Асо${item}`;
#!/usr/bin/env bash
for file in *.webm; do ffmpeg -i "$file" -vf scale=240:-2 "${file%.*}.mp4"; done && echo "All done"
#!/bin/sh
export MESA_GL_VERSION_OVERRIDE=4.4
chmod -R 0700 game desktop winetools desktop-editor editor desktop-fix start
cd "`dirname "$0"`"
# Improvement. Now it will detect active output
# automatically! :) In the dark, I drink a whole
# box of Schweps. How great I am!
active_output=$(xrandr | grep [[:blank:]]connected[[:blank:]] | awk '{ print $1 }')