Skip to content

Instantly share code, notes, and snippets.

View balvinder294's full-sized avatar
😎
Working Remotey

Balvinder Singh balvinder294

😎
Working Remotey
View GitHub Profile
@balvinder294
balvinder294 / user_info.ts
Created December 30, 2017 15:47
Use this code to get User details in jhipster
# If you are looking for the current User's infos, the one who's currently connected :
final String userLogin = SecurityUtils.getCurrentUserLogin();
will get you, by definition, the current user login, then :
Optional<User> currentUser = userRepository.findOneByLogin(userLogin);
will get you the entity User linked to the login, from which you can access all information with
currentUser.get().getEmail() for example
@balvinder294
balvinder294 / component.ts
Created January 23, 2018 15:43
method for getting LoggedIn User details in Jhipster
First inject Principal Service in your component
this.principal.identity().then((account) => {
// get current Account
this.currentAccount = account;
// get a specific field from account
const field = this.currentAccount.field;
//call your get method
this.getMethod(field);
});
@balvinder294
balvinder294 / nifi.yml
Created October 27, 2018 16:26
Docker-compose for NIFI
version: "3"
services:
zookeeper: # the configuration manager
hostname: zookeeper
container_name: zookeeper
image: 'bitnami/zookeeper:latest'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
nifi:
image: apache/nifi:latest
@balvinder294
balvinder294 / spark-compose.yml
Created February 26, 2019 18:44
Spark Compose.yml
version: "2.2"
services:
master:
image: gettyimages/spark
command: bin/spark-class org.apache.spark.deploy.master.Master -h master
hostname: master
environment:
MASTER: spark://master:7077
SPARK_CONF_DIR: /conf
SPARK_PUBLIC_DNS: localhost
@balvinder294
balvinder294 / pom.xml
Created February 26, 2019 18:47
Spark Maven Dependencies
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-core -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.3.3</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
@balvinder294
balvinder294 / ApplicationProperties.java
Last active February 26, 2019 18:57
Application Properties for Spark Configuration in Jhipster
package com.tekraze.sparkhipster.config;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.apache.spark.sql.SparkSession;
@balvinder294
balvinder294 / gist:7adf37718f52193c4e988ef49ca2db91
Created March 29, 2019 14:30
Video player in 18.04 shows a psychedelic mixture instead of a clear video
I had the same problem when playing a MP4 video, totem/gnome-videos displays a purplish corrupted video output and I have done the following:
From the terminal sudo apt-get remove gstreamer1.0-vaapi
I have done a test and yes, the problem has been fixed now I can see the video correctly.
So the problem is gstreamer1.0-vaapi
Best Regards,
@balvinder294
balvinder294 / google-service.java
Last active May 13, 2019 18:14
Sample Code Google Login Oauth2 Java Api
// Required for Http Request and json management for credentials
HttpTransport httpTransport = new NetHttpTransport();
JacksonFactory jsonFactory = new JacksonFactory();
// Go to the Google API Console, open your application's
// credentials page, and copy the client ID and client secret.
// Then paste them into the following code.
String clientId = "YOUR_CLIENT_ID";
String clientSecret = "YOUR_CLIENT_SECRET";
String completeProfileDetailsUrl = "https://api.linkedin.com/v1/people/~:" +
"(id,industry,summary,specialties,headline,public-profile-url," +
"first-name,last-name," +
"positions:(id,title,summary,start-date,end-date,is-current," +
"company:(id,name,type,size,industry,ticker))," +
"educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes)," +
"interests," +
"date-of-birth," +
"picture-urls::(original)," +
"languages:(id,language:(name),proficiency:(level,name))," +
@balvinder294
balvinder294 / push-github-service.js
Created August 7, 2019 11:33
Push Repo online To Github via nodejs
// change current directory to repo directory in local
shellJs.cd('path/to/repo/folder');
// Repo name
const repo = 'dummy'; //Repo name
// User name and password of your GitHub
const userName = 'username';
const password = 'password';
// Set up GitHub url like this so no manual entry of user pass needed
const gitHubUrl = `https://${userName}:${password}@github.com/${userName}/${repo}`;
// add local git config like username and email