Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@edmhs
edmhs / grep_zip_search.sh
Created May 24, 2017 06:16
Search string recursively within zipped files, works good with searching string in TB of data.
for file in 201705/prefix*.zip; do
if ( unzip -c "$file" | grep -q "123456789"); then
echo "$file"
fi
done
@edmhs
edmhs / php_subnet_function.php
Last active May 24, 2017 06:21
Return array with all ip addreses from ip addresses subnet - PHP Subnet mask calculator
<?php
$range = "194.8.42.0/24";
function ipListFromRange($range){
$parts = explode('/',$range);
$exponent = 32-$parts[1].'-';
$count = pow(2,$exponent);
$start = ip2long($parts[0]);
$end = $start+$count;
return array_map('long2ip', range($start, $end) );
@edmhs
edmhs / 1_kubernetes_on_macOS.md
Created June 24, 2018 19:48 — forked from zulhfreelancer/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@edmhs
edmhs / coupons.php
Created May 29, 2017 09:26
Generate unique coupon codes
<?php
//prefi for coupons
$prefix = 'ABCD';
//how many codes you need?
$need = 200;
$codes = array();
while(count($codes)!=$need){
//choose format
@edmhs
edmhs / daksa.php
Last active March 20, 2019 10:38
Very old hack to run multiple php processes. Named "daksa" in translation from Latvian mean "Fork"
<?php
echo date('Y-m-d H:i:s')."\n";
// filename to run
$filename = "check_count.php";
// max processes
$processes = 8;//rand(0,1);
$total = 0;
@edmhs
edmhs / rsa.py
Created November 30, 2018 11:55 — forked from dennislwy/rsa.py
Python helper class to perform RSA encryption, decryption, signing, verifying signatures & generate new keys
# RSA helper class for pycrypto
# Copyright (c) Dennis Lee
# Date 21 Mar 2017
# Description:
# Python helper class to perform RSA encryption, decryption,
# signing, verifying signatures & keys generation
# Dependencies Packages:
# pycrypto