Skip to content

Instantly share code, notes, and snippets.

View dimkouv's full-sized avatar
🐧
hello friend

dimitris dimkouv

🐧
hello friend
View GitHub Profile
package main
import (
"image"
"image/color"
"image/png"
"math"
"math/rand"
"os"
"time"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Particles</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
package main
import (
"image"
"image/color"
"image/png"
"math/rand"
"os"
"time"
)
@dimkouv
dimkouv / bresenham_line.go
Last active January 4, 2020 00:27
bresenham line algorithm
package main
import (
"image"
"image/color"
"image/png"
"os"
)
func line(img *image.RGBA, x1, y1, x2, y2 int, color color.Color, mirror bool) {
@dimkouv
dimkouv / permutations.go
Created September 12, 2019 15:13
number permutations
package main
import "fmt"
func startCounting(numsLen, maxNum int) {
numTable := make([]int, numsLen)
for {
for i := 0; i < maxNum+1; i++ {
numTable[numsLen-1] = i
fmt.Println(numTable)
@dimkouv
dimkouv / gitmirror.sh
Last active June 3, 2019 08:50
Mirror a git repository
#!/bin/bash
# Mirror a git repository
# usage: ./gitmirror.sh <copied-repo> <mirror-repo>
#
# example: ./gitmirror.sh https://github.com/dimkouv/app https://gitlab.com/dimkouv/app
if [[ $# -ne 2 ]] ; then
echo 'Invalid arguments!'
exit 1
@dimkouv
dimkouv / sync.sh
Created February 11, 2019 09:38
Sync directories and files between two servers
#!/bin/bash
# sync.sh
# Syncs directories and files between two servers
MAIN_SERVER_IP='12.34.56.78'
REMOTE_KEY='/home/ubuntu/key.pem'
REMOTE_USER='ubuntu'
# from:to pairs
@dimkouv
dimkouv / random_walk.py
Created January 17, 2018 15:55
random walk example
from random import randint
graph = {
0: [1, 7],
1: [0, 2],
2: [1, 3, 4],
3: [2],
4: [2],
5: [6],
6: [7, 5],
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <string.h>
#include <fcntl.h>
// counts files on the current directory
// linux equivalent "ls -l | wc -l"
@dimkouv
dimkouv / arch-wlan-to-eth.sh
Created August 28, 2017 13:42
Share wifi over ethenet | arch linux
# PC2 <---eth cable--- PC1 <-- ((( wifi )))
# connect as root on PC1
su
# install networkmanager
pacman -S networkmanager
# enable networkmanager and start it
systemctl start NetworkManager