Skip to content

Instantly share code, notes, and snippets.

View Mecanik's full-sized avatar
🎯
Focusing

Norbert Boros Mecanik

🎯
Focusing
View GitHub Profile
@robhammond
robhammond / verify-client-ids.js
Last active December 14, 2022 06:58
Puppeteer script to check that Google Analytics Client ID is consistent across different platforms
'use strict';
const puppeteer = require('puppeteer');
// Test scenarios
// 4 different entrypoints
// ~8 different cookie setting scenarios (ie every page has at least 1 video)
// 2 different pre-set options - cookies and cookie-less
const reqUrls = [
@creatorlxd
creatorlxd / string_converter.cpp
Last active April 2, 2024 09:39
string to wstring and wstring to string
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
wstring StringToWString(const string& str)
{
wstring wstr;
size_t size;
@bom-d-van
bom-d-van / ddos.txt
Created February 12, 2017 11:46
Detecting and Mitigating DDOS Attacks
Detecting and Mitigating DDOS Attacks
#List all Finish (FIN) packets
machine1 : sudo /usr/sbin/tcpdump -Nnn -i any -s0 'tcp[13] & 1 != 0'
#List all SYN and SYN-ACK packets
machine1 : sudo /usr/sbin/tcpdump -Nnn -i any -s0 'tcp[13] & 2 != 0'
@panperla
panperla / ipv6_proxmox_debian_jessie_ovh.md
Last active November 5, 2023 16:19
Setting up IPv6 with Proxmox 4.3 - Debian jessi based on ovh template installation

Setting IPv6 for HOST machine working on Debian jessi and GUEST VM using Proxmox 4.3 installation from ovh template

HOST SECTION

Installation process is giving us ready to use machine which we can access via SSH (port 22) or web interface (port 8006) with setup network interfaces. Unfortunately during the process of testing IPv6 on vanilla Proxmox 4.3 delivered by OVH doesn't work out of the box.

ping6 ipv6.google.com 
connect: Network is unreachable
@artoodetoo
artoodetoo / nogap.php
Last active April 1, 2023 22:19
Efficient Geo IP location in MySQL database
#!/usr/bin/env php
<?php
/*
* Filter to fill the IP gaps in a MaxMind GeoLite tables.
*
* For every missing range in the file it puts a dummy one.
*/
$types = [
'asnum' => [0, 0, 1, "%s,%s,\"-\"\n"],
'blocks' => [2, 0, 1, "\"%s\",\"%s\",\"1\"\n"],
@litefeel
litefeel / urlencode.cpp
Last active July 3, 2024 12:57
c++ urlencode
// http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/package.html#encodeURIComponent()
void hexchar(unsigned char c, unsigned char &hex1, unsigned char &hex2)
{
hex1 = c / 16;
hex2 = c % 16;
hex1 += hex1 <= 9 ? '0' : 'a' - 10;
hex2 += hex2 <= 9 ? '0' : 'a' - 10;
@cbsmith
cbsmith / random_selection.cpp
Last active August 9, 2022 12:29
Hopefully serves as a reference implementation on how to do random selection of an element from a container.
// -*- compile-command: "clang++ -ggdb -o random_selection -std=c++0x -stdlib=libc++ random_selection.cpp" -*-
//Reference implementation for doing random number selection from a container.
//Kept for posterity and because I made a surprising number of subtle mistakes on my first attempt.
#include <random>
#include <iterator>
template <typename RandomGenerator = std::default_random_engine>
struct random_selector
{
//On most platforms, you probably want to use std::random_device("/dev/urandom")()