Skip to content

Instantly share code, notes, and snippets.

View aigor's full-sized avatar

Igor Lozynskyi aigor

  • Ukraine
View GitHub Profile
@aigor
aigor / folder-stats.sh
Created August 18, 2017 12:10
File stats by extension
#!/bin/bash
# Source: https://serverfault.com/questions/367185/calculating-total-file-size-by-extension-in-shell
ftypes=$(find . -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq)
for ft in $ftypes
do
echo -n "$ft "
find . -name "*${ft}" -exec ls -l {} \; | awk '{total += $5} END {print total}'
done
@aigor
aigor / centOS-install-git-docker.sh
Created August 16, 2017 09:51
CentOS install Git & Docker
#!/bin/bash
# Install usefull dependencies
yum install -y git htop atop mc
# Install & strt Docker
yum install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.06.0.ce-1.el7.centos.x86_64.rpm
sudo systemctl start docker
@aigor
aigor / bookmark.js
Created July 4, 2017 10:16
Chrome register/login
javascript:(function(){
var field = function(name, password){ document.getElementById(name).value = password; };
var pass = 'Pa55w0rd';
field('adminPassword', pass);
field('adminConfirmPassword', pass);
field('supervisorPassword', pass);
field('supervisorConfirmPassword', pass);
document.getElementsByTagName('input')[5].removeAttribute('disabled');
@aigor
aigor / portainer-template-minimal.json
Last active June 27, 2017 18:13
Portainer Template
[
{
"title":"Apache Spark",
"description":"Apache Spark with Hadoop distibution",
"categories":[
"spark"
],
"platform":"linux",
"logo":"http://spark.apache.org/images/spark-logo-trademark.png",
"image":"gettyimages/spark:latest",
@aigor
aigor / sslContext.java
Created June 22, 2017 11:49
SSL without certificate check
private SSLContext noCheckSslContext() throws GeneralSecurityException {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(
X509Certificate[] certs, String authType) {
}
@aigor
aigor / RegExp_for_placeholders_${}
Last active February 17, 2017 16:21
RegExp for searching & showing placeholders of type ${}
RegExp to find all Strings of type: ${<something including '#', '(', ')', '.'>}: (?<=\{)[\(\)#\._a-zA-Z0-9]*(?=\})
Show all matches of PATTERN: perl -nle 'print $& if m{PATTERN}' file.txt | sort | uniq
@aigor
aigor / ObservableToIterator.java
Created October 3, 2016 22:11
Observable to Iterator bridje by José Paumard
* Copyright (C) 2015 José Paumard
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@aigor
aigor / MemoryConsumption.java
Last active September 19, 2016 13:37
Java Memory Consumption per Object
package org.aigor;
/**
* Java Memory Consumption per Object
*
* Based on article:
* http://www.javaworld.com/article/2077496/testing-debugging/java-tip-130--do-you-know-your-data-size-.html
* By Vladimir Roubtsov
*/
public class MemoryTest {