Skip to content

Instantly share code, notes, and snippets.

View jamilxt's full-sized avatar
✔️

jamilxt jamilxt

✔️
View GitHub Profile
@wombat
wombat / QRAndLogo.java
Last active December 5, 2023 12:07
QR-Code with embedded logo
// Create new configuration that specifies the error correction
Map<EncodeHintType, ErrorCorrectionLevel> hints = new HashMap<EncodeHintType, ErrorCorrectionLevel>();
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
QRCodeWriter writer = new QRCodeWriter();
BitMatrix bitMatrix = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
// Create a qr code with the url as content and a size of 250x250 px
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@udacityandroid
udacityandroid / onCreate method in MainActivity.java
Created May 13, 2016 18:17
Use OnClickListeners for All Categories - onCreate method in MainActivity.java
// Find the View that shows the numbers category
TextView numbers = (TextView) findViewById(R.id.numbers);
// Set a click listener on that View
numbers.setOnClickListener(new View.OnClickListener() {
// The code in this method will be executed when the numbers View is clicked on.
@Override
public void onClick(View view) {
Intent numbersIntent = new Intent(MainActivity.this, NumbersActivity.class);
startActivity(numbersIntent);
@ekswai
ekswai / UserRestControllerTest.java
Last active October 23, 2022 13:39
spring oauth2 rest template with client credentials grant sample
import org.junit.Test;
import org.junit.runner.RunWith;
import org.master.Application;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
@DevoKun
DevoKun / kafka.md
Created July 13, 2018 02:52
How to operate Kafka, mostly using Docker

Kafka Distributed Streaming Platform

Publish and Subscribe / Process / Store

Start Kafka

  • Kafka uses ZooKeeper as a distributed backend.

Start Zookeeper

@thomasdarimont
thomasdarimont / App.java
Created November 6, 2018 19:09
Simple Spring Boot App protected by Keycloak with initial roles from Keycloak and additional hierarchical app Internal roles. Supports fine grained permission checks, where the permissions are derived from roles.
package demo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@mainul35-bs23
mainul35-bs23 / MySQL user grants and Password policy reset.md
Last active September 3, 2020 18:58
MySQL user grants and Password policy reset

Background story

It is a common scenario that we often forget out database password. When we try to log in to our mysql DB, we face the following error message. If we use a password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

If we don't use a password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
@Sadmansamee
Sadmansamee / flutter_starter.md
Last active February 9, 2023 03:44
Flutter Starter Kits
@iolufemi
iolufemi / Dockerfile
Created November 5, 2021 22:23
Add Pentaho to Apache Fineract in a Docker Environment
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#