Skip to content

Instantly share code, notes, and snippets.

View alekpopovic's full-sized avatar
🏠
Working from home

Aleksandar Popovic alekpopovic

🏠
Working from home
View GitHub Profile
@alekpopovic
alekpopovic / website-dl.md
Created July 2, 2025 22:31 — forked from stvhwrd/website-dl.md
Download an entire website for offline use with wget. Internal inks will be corrected so that the entire downloaded site will work as it did online.

The best way to download a website for offline use, using wget

There are two ways - the first way is just one command run plainly in front of you; the second one runs in the background and in a different instance so you can get out of your ssh session and it will continue.

First make a folder to download the websites to and begin your downloading: (note if downloading www.SOME_WEBSITE.com, you will get a folder like this: /websitedl/www.SOME_WEBSITE.com/)


STEP 1:

It can be difficult to test the different scenarious for a module intended for use by including in another class.

If the class is statically defined in the spec, any later definitions extend, not replace, the first definition - which can cause test issues and breaks isolation between examples.

RSpec.describe SomeModule do
  class SomeIncluder
    include SomeModule
  end
 
@alekpopovic
alekpopovic / control.sh
Created May 20, 2025 11:30 — forked from Frederick888/control.sh
Bash script to pull latest Docker container, (re)start container if needed, and clean up dangling images
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
IMAGE=
TAG='latest'
CONTAINER=
function printf() {
format="\e[1;31m$1\e[m"
shift
@alekpopovic
alekpopovic / ePorezi-Linux.md
Created May 13, 2025 12:02 — forked from grakic/ePorezi-Linux.md
ePorezi na GNU/Linuxu

ePorezi na GNU/Linuxu

Zvanična klijentska aplikacija Poreske uprave se može preuzeti sa njihove stranice.

U pitanju je Java aplikacija koja dolazi sa posebno priređenom distribucijom Oracle Java radnog okruženja. Aplikacija podržava samo Microsoft Windows operativni sistem i sertifikatima u Personals skladištu pristupa kroz Microsoft CryptoAPI koji poziva operacije na pametnoj kartici ili tokenu posredstvom midlvera.

Sertifikaciono telo Pošte korisnicima nudi SafeSign midlver, osim u verziji za Windows i u verziji za GNU/Linux i macOS operativne sisteme. Midlver isporučuje prateću aplikaciju za upravljanje karticom/tokenom i PKCS#11 biblioteku. Programi poput jSignPDF, Evolution ili LibreOffice mogu da učitaju ovu biblioteku i omoguće korisniku elektronsko potpisivanje dokumenata.

Elektronsko potpisivanje se koristi i na portalu ePorezi Poreske uprave, posredstvom pomenute klijentske aplikacije.

@alekpopovic
alekpopovic / Readme.md
Created April 29, 2025 21:46 — forked from saniaky/Readme.md
Docker + nginx-proxy + let's encrypt + watchtower + fail2ban

Complete solution for websites hosting

This gist contains example of how you can configure nginx reverse-proxy with autmatic container discovery, SSL certificates generation (using Let's Encrypt) and auto updates.

Features:

  • Automatically detect new containers and reconfigure nginx reverse-proxy
  • Automatically generate/update SSL certificates for all specified containers.
  • Watch for new docker images and update them.
  • Ban bots and hackers who are trying to bruteforce your website or do anything suspicious.
@alekpopovic
alekpopovic / Backup&RestoreRepo.md
Created April 1, 2025 18:11 — forked from xtream1101/Backup&RestoreRepo.md
Backup and restore a git repo using git bundle

Backup/archive a repo

  1. Clone the repo
git clone --mirror https://github.com/vuejs/vue
  1. cd into the cloned repo
  2. Create a bundle file in the parent directory
git bundle create ../vuejs_vue.bundle --all
// ==UserScript==
// @name Git Archive
// @namespace http://wingysam.xyz/
// @version 2.4
// @description Mirror every git repo you look at to gitea
// @author Wingy <[email protected]>
// @include *
// @grant GM_xmlhttpRequest
// @grant GM_notification
// @grant GM_openInTab
@alekpopovic
alekpopovic / verify_hmac.js
Created February 9, 2025 19:34 — forked from turret-io/verify_hmac.js
Verify HMAC in NodeJS
var crypto = require('crypto');
// Added for safer string equality checking
var bufferEq = require('buffer-equal-constant-time');
var url = require('url');
var SHARED_SECRET = "sup3rs3cr3t!!";
function verifySignature(string_to_sign, signature, shared_secret) {
var hmac = crypto.createHmac('sha512', shared_secret);
hmac.write(string_to_sign);
hmac.end()
@alekpopovic
alekpopovic / net.js
Created October 15, 2024 17:38 — forked from sid24rane/net.js
Simple TCP Client and Server in Node.js (Covering all useful Properties & Methods)
var net = require('net');
// creates the server
var server = net.createServer();
//emitted when server closes ...not emitted until all connections closes.
server.on('close',function(){
console.log('Server closed !');
});
@alekpopovic
alekpopovic / echo.js
Created October 15, 2024 17:32 — forked from bszwej/echo.js
Pure Node.js echo server, that logs all incoming http requests (method, path, headers, body).
const http = require('http');
const server = http.createServer();
server.on('request', (request, response) => {
let body = [];
request.on('data', (chunk) => {
body.push(chunk);
}).on('end', () => {
body = Buffer.concat(body).toString();