Skip to content

Instantly share code, notes, and snippets.

Petra Barus petrabarus

Block or report user

Report or block petrabarus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View install-and-run-sonar-scanner.sh
#!/usr/bin/env bash
VERSION=3.3.0.1492-linux
echo "Downloading sonar-scanner....."
rm -rfv /tmp/sonar-scanner-cli-$VERSION.zip
wget -P /tmp/ -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$VERSION.zip
echo "Download completed."
echo "Unziping downloaded file..."
unzip -q /tmp/sonar-scanner-cli-$VERSION.zip -d /tmp/
View install-sonar-scanner.sh
#!/usr/bin/env bash
VERSION=3.3.0.1492-linux
echo "Downloading sonar-scanner....."
rm -rfv /tmp/sonar-scanner-cli-$VERSION.zip
wget -P /tmp/ -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$VERSION.zip
echo "Download completed."
echo "Unziping downloaded file..."
unzip /tmp/sonar-scanner-cli-$VERSION.zip -d /tmp/
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title></title>
@petrabarus
petrabarus / checkstyle.sh
Created Jun 21, 2017
Wrapper Script for PHP, CSS, and JS style check in pre-commit
View checkstyle.sh
#!/bin/bash
###############################################################################
# Check style for list of code
# For source code
# - PHP
# - JS (js, es6, jsx)
# - CSS (css, scss, less)
# This can be used in build server or pre-commit hook in git, depends on the
# SOURCE_FILE variable.
###############################################################################
View handler.py
import sys
sys.path.append('gen-py')
sys.path.append('vendored')
from thrift.protocol import TBinaryProtocol, TJSONProtocol
from thrift.server import TServer
from thrift.transport import TTransport
from lambda_thrift_service import MultiplicationService
class MultiplicationServiceHandler(object):
def multiply(self, i, j):
@petrabarus
petrabarus / CitySpinner.java
Last active Sep 29, 2018
Android Dependent Two-Way Data Binding
View CitySpinner.java
package net.petrabarus.testandroid.dynamicdatabinding;
import android.content.Context;
import android.databinding.BindingAdapter;
import android.databinding.InverseBindingAdapter;
import android.databinding.InverseBindingListener;
import android.databinding.InverseBindingMethod;
import android.databinding.InverseBindingMethods;
import android.databinding.Observable;
import android.util.AttributeSet;
@petrabarus
petrabarus / command.sh
Created Oct 28, 2016
Execute random variable for each xargs argument
View command.sh
#!/usr/bin/env bash
seq 10 | xargs -I X bash -c "echo X \$RANDOM"
@petrabarus
petrabarus / command.sh
Created Oct 28, 2016
Group lines from file to be executed in MySQL WHERE .. IN ...
View command.sh
#!/usr/bin/env bash
seq 12 | pr -7ats, | xargs -I X echo "SELECT * FROM Table WHERE id IN (X)"
#output
#SELECT * FROM Table WHERE id IN (1,2,3,4,5,6,7)
#SELECT * FROM Table WHERE id IN (8,9,10,11,12)
seq 12 | pr -7ats | xargs -I X mysql database -e "DELETE FROM Table WHERE id IN (X)"
@petrabarus
petrabarus / gist:367f58fa0b4deecdac7159d9af42dccf
Last active Oct 28, 2016
Get AWS Spot Instances using AWS CLI and execute command via SSH
View gist:367f58fa0b4deecdac7159d9af42dccf
#!/usr/bin/env bash
aws ec2 describe-spot-instance-requests | \
jq -r '.SpotInstanceRequests | .[] | select(.LaunchSpecification.InstanceType == "c4.8xlarge" and .State == "active") | .InstanceId' | \
xargs -I X sh -c "aws ec2 describe-instances --instance-id X | jq -r .Reservations[0].Instances[0].PublicDnsName" | \
xargs -I X ssh -i ~/mykey.pem ubuntu@X "echo \"Hello WOrld\""
View CircleChart.js
/**
* This function creates object which draws
* chart.
* Usage:
* var chart = new myChart();
* chart.init('canvas');
*
* Author: numlock
* email: faraslacks@gmail.com
* Created: 26.11.14.
You can’t perform that action at this time.