Skip to content

Instantly share code, notes, and snippets.

View tamirko's full-sized avatar

Tamir Korem tamirko

  • www.whitesourcesoftware.com
View GitHub Profile
@tamirko
tamirko / pom.xml
Created October 8, 2019 15:10
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.whitesource</groupId>
<artifactId>log4j-netty-sample</artifactId>
<version>1.0-SNAPSHOT</version>
@tamirko
tamirko / GotoCellOrRow.js
Last active January 28, 2020 09:20
How to go to a specific row or cell or to the 1st empty row in a Google sheet
function onOpen()
{
var menuEntries = [{name: "Go to Cell", functionName: "goToCell"}, {name: "Go to Row", functionName: "goToRow"},{name: "Go to 1st empty Row", functionName: "selectFirstEmptyRow"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu("MyUtils", menuEntries);
}
function goToCell()
{
var strRange = Browser.inputBox("Insert the required cell (e.g.: B351):", Browser.Buttons.OK_CANCEL);
if(strRange != "cancel")
@tamirko
tamirko / regex_groups.sh
Created August 1, 2017 07:52
group groups grouping regular expressions regex regexp
# group groups grouping regular expressions regex regexp
sed -e "s+\(.*\)\(, .*$\)+\1+g"
export x="00:00:52.76, start"
export y=`echo $x | sed -e "s+\(.*\)\(, .*$\)+\1+g"`
echo -${y}-
# Output :
#-00:00:52.76-
@tamirko
tamirko / createPostgresDump.sh
Created May 24, 2017 08:26
Create a Postgres Dump
#!/bin/bash
clear
dbName="partner"
# all tables
tableNames=(alembic_version customers dynamic global_id logins products random_ascii resource_cache resources static_content variables)
# only relevant tables
tableNames=(customers dynamic products)
@tamirko
tamirko / delete_all_cfy.sh
Last active May 22, 2017 11:44
Delete all cfy executions deployments and blueprints
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Error: Missing deployment name/id"
echo " Usage: $0 deployments_id"
exit
fi
deploymentName=$1
clear
@tamirko
tamirko / concatSrts.sh
Created May 11, 2017 07:38
Concatenate several srt file into one file with renumbering all the entries and shifting all the timestamps
#!/bin/bash
clear
# Install this 1st :
# sudo apt install subtitleripper
cd ~/tmp/test1005
export rawTotalSrt="rawTotal.srt"
export totalSrt="total.srt"
@tamirko
tamirko / ip_in_range.py
Last active April 3, 2024 17:08
Check if ip address is in range in Python
# Prior to using this code, you need to run : pip install netaddr
from netaddr import *
from netaddr import iter_iprange
def is_in_subnet(input_addr, subnet_addr, subnet_mask):
current_subnet_str = '{0}/{1}'.format(subnet_addr, subnet_mask)
curr_subnet = IPNetwork(current_subnet_str)
for curr_ip in curr_subnet:
@tamirko
tamirko / products.json
Last active April 7, 2017 12:12
products.json
[
{
"product_type": "CPE",
"siebel_customer_id": "1-1X9Y-364",
"extra_fields": {
"Site": "Jerusalem"
},
"siebel_asset_id": "123741",
"product_serial_id": "994465",
"product_name": "ONE ISP Vtech LAD 303 (Orange) Smart Box"
@tamirko
tamirko / gotoCell.js
Last active March 23, 2024 16:53
How to go to a specific cell in a Google sheet ?
function onOpen()
{
var menuEntries = [{name: "Go to", functionName: "goToCell"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu("MyUtils", menuEntries);
}
function goToCell()
{
var strRange = Browser.inputBox("Insert the required cell (e.g.: B351):", Browser.Buttons.OK_CANCEL);
if(strRange != "cancel")
@tamirko
tamirko / clearDataCentred.sh
Last active September 20, 2016 11:08
Clear DataCentred OpenStack
#!/bin/bash
for routerID in `neutron router-list | grep -viE "cfy|management|mngmnt|--|external_gateway_info|composer|cloudify" | awk -F\| '{ print $2}' | sed 's/ //g'`; do
echo " xxx routerID is $routerID"
export subnetID=`neutron router-port-list $routerID | grep -viE "cfy|management|fixed_ips|--|composer|cloudify" | awk -F\| '{print $5}' | awk -F: '{print $2}' | awk -F, '{print $1}' | sed -e 's/[" ]//g'`
echo " xxx subnetID is $subnetID"
for portIDFloating in `neutron floatingip-list | awk -F\| '{ print $5 }' | sed 's/ //g' | grep "-" | grep -v "port"`; do
echo " xxx portIDFloating is $portIDFloating"
export portInSubnet=`neutron port-list -c id -c fixed_ips | grep $subnetID | grep -c "${portIDInFloating}"`
echo " xxx portInSubnet is $portInSubnet"