Skip to content

Instantly share code, notes, and snippets.

View pcnoic's full-sized avatar
🌍
Working from planet earth

Christos Alexiou pcnoic

🌍
Working from planet earth
View GitHub Profile
@pcnoic
pcnoic / combinations.py
Last active January 21, 2021 20:56
all possbile combinations of numbers
from itertools import permutations
comb = permutations([1, 2, 3], 3)
for i in comb:
print(i)
@pcnoic
pcnoic / forloops.c
Created January 21, 2021 21:02
for loops for finding all combinations
for (j = 1; j <= n; j++) {
for (i = 0; i < n-1; i++) {
temp = num[i];
num[i] = num[i+1];
num[i+1] = temp;
print(num, n);
}
}
@pcnoic
pcnoic / printer.c
Created January 21, 2021 21:08
weird printing function
void print(int *A, int N)
{
int i;
for ( i = 0 ; i < N ; i++)
printf("%d ", *(A + i);
printf("\n");
}
@pcnoic
pcnoic / bestcode.c
Created January 21, 2021 22:59
code that will save your live
#include <stdio.h>
#include <stdlib.h>
int *read(int);
int oria(int,int);
int readx();
int ready();
int oriay(int,int);
void printc(int *);
int poscomb(int);
@pcnoic
pcnoic / refresh.html
Last active April 14, 2021 17:07
refresh DOM element with vanilla JS
<!DOCTYPE html>
<html>
<head>
<title>CAM1 - Peristera's Shipwreck - Alonissos Greece</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
html, body {
background-color: #111;
text-align: center;
}
@pcnoic
pcnoic / player_refresh.html
Created April 14, 2021 19:43
refresh jsmpeg player after 60 seconds to minimize stream latency
<!DOCTYPE html>
<html>
<head>
<title>CAM1 - Peristera's Shipwreck - Alonissos Greece</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
html, body {
background-color: #111;
text-align: center;
}
---
version: "2.1"
services:
piwigo:
image: ghcr.io/linuxserver/piwigo
container_name: piwigo
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/London
@pcnoic
pcnoic / points_of_interest-emma.sql
Created August 12, 2021 12:15
create table for pois
CREATE TABLE points_of_interest(
id BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY
,type_id BIGINT(20) UNSIGNED NOT NULL
,name VARCHAR(77) NOT NULL
,latitude FLOAT NOT NULL
,longitude FLOAT NOT NULL
,active BIT NOT NULL
,created_at DATETIME NOT NULL
,updated_at DATETIME NOT NULL
,description VARCHAR(85) NOT NULL
@pcnoic
pcnoic / nginx.conf
Last active June 17, 2022 22:11
simple nginx conf
server {
listen 80;
server_name localhost;
port_in_redirect off;
autoindex on;
add_header Access-Control-Allow-Origin *;
location / {
root /spa;
try_files $uri $uri/ /index.html;
}
@pcnoic
pcnoic / unused_range.sh
Created September 21, 2021 10:05
unused port range finder
#!/usr/bin/env bash
starting_port=$1
ending_port=$2
free_range=true
function check_range {
echo "Checking if range is free..."
for i in $(seq $starting_port $ending_port); do
echo "Checking port $i"