Skip to content

Instantly share code, notes, and snippets.

@vasilews
vasilews / convert.sh
Created September 14, 2024 07:02 — forked from mebaysan/convert.sh
Ubuntu Screen Recorder WEBM to MP4
#! /bin/bash
# sudo apt-get install ffmpeg
# if ffmpeg is not installed, install it
if ! [ -x "$(command -v ffmpeg)" ]; then
sudo apt-get install ffmpeg
fi
# if no arguments are given, print usage
@vasilews
vasilews / Traversal Fuzzer
Created February 20, 2024 13:28 — forked from OblivionDev/Traversal Fuzzer
Path Traversal Fuzzer
#!/usr/bin/env ruby
require 'wwmd'
require 'example_mixins'
include WWMD
puts "Traversal Fuzzer made by Outlasted\n Greetz to .:TeaMp0isoN:."
opts = { :base_url => "http://www.example.com" }
page = Page.new(opts)
spider = page.spider ;
spider.set_ignore([ /logout/i, /login/i ]) ;
while (url = spider.next) ;
@vasilews
vasilews / Python Copy Text to Clipboard (Linux).md
Created January 29, 2024 00:00 — forked from ShannonScott/Python Copy Text to Clipboard (Linux).md
[Python Copy Text to Clipboard] Copy Text to the Linux / X Clipboard. #tags: linux, python

Copy Text to the Linux / X Clipboard

from subprocess import Popen, PIPE

def copy_clipboard(msg):
    ''' Copy `msg` to the clipboard '''
    with Popen(['xclip','-selection', 'clipboard'], stdin=PIPE) as pipe:
        pipe.communicate(input=msg.encode('utf-8'))
@vasilews
vasilews / proxy.py
Created December 19, 2023 04:37 — forked from edxmorgan/proxy.py
Proxy integrated into selenium in scrapy middleware
# Define here the models for your spider middleware
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
import sys
import time
import logging
from scrapy import signals
from scrapy.mail import MailSender
from scrapy.utils.project import get_project_settings
@vasilews
vasilews / file-upload-multipart.go
Created September 19, 2023 03:08 — forked from andrewmilson/file-upload-multipart.go
Golang multipart/form-data File Upload
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@vasilews
vasilews / uuid.js
Created June 2, 2023 10:31 — forked from shamil/uuid.js
UUID v4 generator in JavaScript (RFC4122 compliant)
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-"
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
@vasilews
vasilews / bank_test.py
Created May 26, 2023 08:46 — forked from mrcfps/bank_test.py
Exploration of how to test concurrency in Python
from __future__ import print_function
import platform
import sys
import threading
import time
class UnsyncedBankAccount(object):
"""Bank account with no synchronization lock, prone to race condition."""
@vasilews
vasilews / ruby_ipv4_notations.rb
Created January 8, 2023 10:37 — forked from bsingr/ruby_ipv4_notations.rb
Convert Ipv4 Addresses between Integer and dot-decimal notation using ruby
# How to convert IPv4 addresses between integer <=> dot-decimal notation
INTEGER = 1698212032
DOT_DECIMAL = '192.168.56.101'
# [ 192, 168, 56, 101 ]
DOT_DECIMAL_PARTS = DOT_DECIMAL.split('.').map(&:to_i)
####################################
# integer to dot-decimal
@vasilews
vasilews / postgres-brew.md
Last active December 14, 2022 04:14 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@vasilews
vasilews / getRandomLatLng.js
Created November 17, 2022 04:30 — forked from stefanocudini/getRandomLatLng.js
leaflet random lat lng in map
function getRandomLatLng(map) {
var bounds = map.getBounds(),
southWest = bounds.getSouthWest(),
northEast = bounds.getNorthEast(),
lngSpan = northEast.lng - southWest.lng,
latSpan = northEast.lat - southWest.lat;
return new L.LatLng(
southWest.lat + latSpan * Math.random(),
southWest.lng + lngSpan * Math.random());