Skip to content

Instantly share code, notes, and snippets.

View mskf3000's full-sized avatar
💭
I may be slow to respond.

MSKF3000 mskf3000

💭
I may be slow to respond.
View GitHub Profile
@VictorLaskin
VictorLaskin / Dockerfile
Created February 3, 2015 15:27
Dockerfile which builds CURL FOR ANDROID using x86 ARCH
# THIS DOCKERFILE TRIES TO COMPILE CURL FOR ANDROID x86 ARCH
# Description - http://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/
FROM ubuntu
MAINTAINER Victor Laskin "[email protected]"
# Install compilation tools
RUN apt-get update && apt-get install -y \
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
struct in_addr ip;
struct hostent *hp;
@lordkhonsu
lordkhonsu / gist:7eca5cbf0440589946c7
Last active February 19, 2023 23:15
bash sed anonymize ip adresses in file

This line will replace the last octet of ipv4 adresses in a given file with a zero:

sed -i '' -e 's/(([0-9]{1,3}.){3})[0-9]{1,3}/\10/g'

@staaldraad
staaldraad / ipconv.py
Last active August 28, 2022 05:09
Quick script to generate different formats for a given IP address.
#!/usr/bin/env python
import sys
if len(sys.argv) < 2:
print "Enter IP address as first argument: python %s 127.0.0.1"%sys.argv[0]
sys.exit(1)
ip = sys.argv[1]
ips = ip.split('.')
iph = '0x{:02X}.0x{:02X}.0x{:02X}.0x{:02X}'.format(*map(int, ips))
@apparentlymart
apparentlymart / iptables-round-robin.sh
Last active December 20, 2024 02:49
round robin to three ports on the same host with iptables
# The following example shows a way to use iptables for basic round-robin load balancing, by redirecting
# packets two one of three ports based on a statistic counter.
#
# TCP packets for new sessions arriving on port 9000 will rotate between ports 9001, 9002 and 9003, where
# three identical copies of some application are expected to be listening.
#
# Packets that aren't TCP or that related to an already-established connection are left untouched, letting
# the standard iptables connection tracking machinery send it to the appropriate port.
#
# For this to work well, connections need to be relatively short. Ideally there would be an extra layer
@t3rmin4t0r
t3rmin4t0r / splitgz.awk
Created July 31, 2015 18:58
To Split and Gzip at the same time
#!/usr/bin/env gawk -f
BEGIN { id = 0;
cmd = "gzip -c -2";
ext = ".gz";
file = sprintf("%04d%s",id, ext);
print "Opening new file " file " at " NR " rows";
count = 1000000;
}
# Use pipes
ProductID Database
106 GeoIP.dat
111 GeoIPOrg.dat
112/115 GeoIPRegion.dat
117 GeoIPASNum.dat
119 GeoIPUserType.dat
121/122 GeoIPISP.dat
132/133 GeoIPCity.dat
135 GeoIPAreaCode.dat
137 GeoIPDMACode.dat
@toringe
toringe / cidr.py
Created October 22, 2015 10:28
Merge CIDR blocks into super blocks if possible
#!/usr/bin/env python
#
# Example 1: All blocks in list.txt, one CIDR per line
# cat list.txt | cidr.py
#
# Example 2: Echo CIDR blocks to stdout
# echo 1.2.3.0/25 1.2.3.128/25 | cidr.py
import sys
from netaddr import *
@joepie91
joepie91 / vpn.md
Last active October 15, 2025 05:37
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@kenoir
kenoir / stun.sh
Last active October 7, 2023 07:56
Proxy local port to remote host via SSH
#!/bin/bash
#Usage: ./stun.sh [email protected] [Destination port] [Local port (optional)]
DESTINATION=$1
DEST_PORT=$2
PROXY_PORT=$((RANDOM%10000+10000))
#Set local port to same as remote if unset