Skip to content

Instantly share code, notes, and snippets.

View KalemaEdgar's full-sized avatar
💯
Learning & Changing the World

Kalema Edgar KalemaEdgar

💯
Learning & Changing the World
View GitHub Profile
@KalemaEdgar
KalemaEdgar / git-recover-deleted-files.txt
Last active November 3, 2021 12:15
How to recover deleted files from Git
Display a location summary of all deleted files.
$ git log --diff-filter=D --summary
commit fd87304411b93bbf7414f39251ba5e4134b27755 (HEAD)
Author: Kalema Edgar <testemail@gmail.com>
Date: Wed May 1 14:02:36 2019 +0300
Revert "Version 1.0.0 for app"
This reverts commit 81585e50d2523c76f9ce7a4375e9b548895773f0.
delete mode 100644 bootstrap.php
@KalemaEdgar
KalemaEdgar / postgresql-size-of-objects.md
Last active February 20, 2020 22:51
PostgreSQL - get sizes of the database, tables and indexes

PostgreSQL table size

To get the size of a specific table, you use the pg_relation_size() function which returns the size of a specific table in bytes. For example, you can get the size of the actor table in the dvdrental sample database as follows:

SELECT pg_relation_size('TableName');

pg_relation_size
------------------
    16384
@KalemaEdgar
KalemaEdgar / postgresql-connections.md
Last active February 20, 2020 22:52
PostgreSQL - querying for users connections and session times

Report on connected users and session time

SELECT pid as process_id, 
   usename as username, 
   datname as database_name, 
   client_addr as client_address, 
   application_name,
   backend_start,
   state,
 state_change
@KalemaEdgar
KalemaEdgar / CreateTrigger.php
Created March 4, 2020 18:39 — forked from me-shaon/CreateTrigger.php
Sample Laravel migration to create MySQL Trigger
<?php
use Illuminate\Database\Migrations\Migration;
class CreateTrigger extends Migration
{
public function up()
{
DB::unprepared('
CREATE TRIGGER tr_after_main_insert AFTER INSERT ON `main` FOR EACH ROW
@KalemaEdgar
KalemaEdgar / wso2-identity-server-errors.txt
Last active March 28, 2020 09:44
WSO2 Identity server errors when implementing single sign on.
HTTP ERROR 500
Problem accessing /saml2-web-app-pickup-dispatch.com/home.jsp. Reason:
Server Error
Caused by:
javax.servlet.ServletException: org.wso2.carbon.identity.sso.agent.exception.SSOAgentException: Signature validation failed for SAML2 Element
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:168)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:505)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
@KalemaEdgar
KalemaEdgar / wso2-identity-server-service-provider-errors.txt
Last active March 30, 2020 16:13
WSO2 errors when adding a service provider
[2020-03-30 00:06:14,387] [0968666f-3f8a-49d5-9ce1-02075e5d10dc] INFO {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil} - 'admin@carbon.super [-1234]' logged in at [2020-03-30 00:06:14,387+0300]
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to move file C:\Program Files\WSO2\Identity Server\5.10.0\repository\logs\wso2carbon.log to C:\Program Files\WSO2\Identity Server\5.10.0\repository\logs\wso2carbon-03-29-2020.log: java.nio.file.FileSystemException C:\Program Files\WSO2\Identity Server\5.10.0\repository\logs\wso2carbon.log -> C:\Program Files\WSO2\Identity Server\5.10.0\repository\logs\wso2carbon-03-29-2020.log: The process cannot access the file because it is being used by another process.
Ignored FQCN: org.apache.logging.log4j.spi.AbstractLogger
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Unable to delete file C:\Program Files\WSO2\Identity Server\5.10.0\repository\logs\wso2carbon.log: java.nio.file.FileSystemException C:\Program Files\WSO2\Identity Server\5.10.0\r
@KalemaEdgar
KalemaEdgar / opensource-contributions.md
Last active April 8, 2020 10:04
Contributing to a project or package

Contributing to a project or package

Tools used

  • OpenSource Project - simplesamlphp project
  • Platform - Github but any code versioning software could work

Fork the project & clone it locally.

Click the "fork" button in GitHub. This will create a copy of the repository in your own GitHub account and you’ll see a note that it’s been forked underneath the project name.

@KalemaEdgar
KalemaEdgar / wso2-simplesamlphp-request-response.txt
Created April 19, 2020 03:54
SAML Request and response that keeps redirecting
*******************************************
REQUEST
*******************************************
<samlp:AuthnRequest
AssertionConsumerServiceURL="https://localhost.com/simplesaml/modules/saml/sp/saml2-acs.php/wso2-sp"
Destination="https://localhost.com:9443/samlsso" ID="_dde1b120b60c8e7c67c327c82250cc9a947f454021"
IssueInstant="2020-04-19T01:27:34Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Version="2.0" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
@KalemaEdgar
KalemaEdgar / wso2-identity-server-errror-on-adding-new-user.txt
Created April 25, 2020 15:23
WSO2 Identity server 5.10.0 error on adding new user to a mysql user store
TID: [-1234] [] [2020-04-24 23:19:54,340] [449cb19d-a3cb-4f44-92d2-f3ac9731bc69] ERROR {org.wso2.carbon.user.mgt.ui.UserAdminClient} - Error while persisting user : renault org.wso2.carbon.user.mgt.stub.UserAdminUserAdminException: UserAdminUserAdminException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at org.wso2.carbon.user.mgt.stub.UserAdminStub.addUser(UserAdminStub.java:1802)
at org.wso2.carbon.user.mgt.ui.UserAdminClient.addUser(UserAdminClient.java:94)
at org.apache.jsp.user.add_002dfinish_002dajaxprocessor_jsp._jspService(add_002dfinish_002dajaxprocessor_jsp.java:211)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)