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 / cleaner.py
Created October 3, 2021 15:58
Delete files older than 3 months by parsing dates in filename
#!/usr/bin/env python3
# Simple script to delete files older than 3 months.
# Usage: ./clean.py <path-of-dir-to-clean>
import os
import sys
import re
import datetime
from datetime import datetime as dt
@pcnoic
pcnoic / interpolation.example
Created October 1, 2021 11:42
Jinja variable interpolation in bash scripts (SaltStack context)
# maps.jinja
{%- set Home_path= "/suser/app/HC_CIFP/ci/nodel" %}
{%- set port = 8068 %}
# init.sls
test:
file.managed:
- name: /tmp/script
- source:
@pcnoic
pcnoic / searcher.py
Created September 25, 2021 19:41
search in uncompressed data
import py7zr
import sys
import os
f = sys.argv[1]
s_term = sys.argv[2]
d_input = os.listdir(path='./')
@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"
@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 / 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
---
version: "2.1"
services:
piwigo:
image: ghcr.io/linuxserver/piwigo
container_name: piwigo
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/London
@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;
}
@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 / 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);