Skip to content

Instantly share code, notes, and snippets.

View sorinmircea's full-sized avatar
🎯
Focusing

Sorin Mircea sorinmircea

🎯
Focusing
View GitHub Profile
#!/bin/sh
BACKUP_DIR=/server/data # Directory to backup
BACKUP_DEST=/server/backups # Backup destination directory
BACKUP_NAME=backup-$(date +%Y%m%d).tar.gz # Name of the backup file with date and compression
LOGFILE=${BACKUP_DEST}/backup-script-$(date '+%Y%m%d').log # Logfile location in same directory but different extension
echo "---------------------------------" >> $LOGFILE
echo "Backup started on $(date)" | tee -a $LOGFILE
@sorinmircea
sorinmircea / gist:c6dbb8987e62f679e27b0dfd3271f265
Created October 16, 2025 19:43
Caddyfile configuration for my VPS
version: '3.8'
services:
caddy:
image: caddy:2.8.0
cap_add:
- NET_ADMIN
ports:
- "80:80"
- "443:443"
@sorinmircea
sorinmircea / gist:6e39ed548cb107dd19eaa4413a4dac3d
Created October 16, 2025 19:22
Automatically deploy docker based services from git repository
#!/bin/bash
# Parse command-line arguments
FORCE=false
while [[ "$#" -gt 0 ]]; do
case $1 in
--force) FORCE=true ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
@sorinmircea
sorinmircea / gist:9a816a78bcfe6634ec2de0886286eb12
Created August 11, 2024 11:12
Setting up YubiKey for SSH Access
ykman piv access change-pin
ykman piv access change-puk
ykman piv access change-management-key -g -p
ykman piv keys generate 9a key.pem
ykman piv certificates generate -s "CN=SSH-key" 9a key.pem
ssh-keygen -D /usr/local/Cellar/opensc/0.25.1/lib/opensc-pkcs11.so -e > key_ssh.pub
@sorinmircea
sorinmircea / fmel-checker.js
Last active July 16, 2024 10:29
FMEL auto-checker
const puppeteer = require('puppeteer');
require('dotenv').config()
const Sentry = require('@sentry/node');
Sentry.init({ dsn: process.env.SENTRY_DSN });
var cron = require('node-cron');
var http = require('http');
var HOUSES_FOR_DATE = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
var EVERY_MINUTES = 3
cron.schedule('*/' + EVERY_MINUTES + ' * * * *', async () => {
@sorinmircea
sorinmircea / Incrementer.sol
Created March 4, 2021 11:14
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.4+commit.3f05b770.js&optimize=false&runs=200&gist=
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.4;
contract Incrementer {
uint256 public number;
constructor(uint256 _initialNumber) {
number = _initialNumber;
}
docker pull neo4j
docker run --publish=7474:7474 --publish=7687:7687 --volume=path/from/pc:/data neo4j
@sorinmircea
sorinmircea / Docker shell commands.sh
Created July 24, 2017 09:37 — forked from bahmutov/Docker shell commands.sh
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html