Skip to content

Instantly share code, notes, and snippets.

View gwokudasam's full-sized avatar
:octocat:
Focusing

gwokudasam gwokudasam

:octocat:
Focusing
View GitHub Profile
@gwokudasam
gwokudasam / AndroidEncryptedMP3LocalHTTPServer.java
Created January 3, 2016 17:31 — forked from thedumbtechguy/AndroidEncryptedMP3LocalHTTPServer.java
A Local HTTP Streaming Server (LocalHTTPServer) for Android. This version was specifically made to stream encrypted MP3 files using a CipherInputStream to MediaPlayer but should be easily modified to work on ordinary files. It has been tested on API 9+ and works fine on large files (tested on up to 20MB files) and also supports range requests. I…
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@gwokudasam
gwokudasam / ExampleDelegate.h
Created September 3, 2016 10:09 — forked from spr/ExampleDelegate.h
An Example NSURLConnection delegate
//
// ExampleDelegate.h
// Example
//
// Created by Scott Robertson on 2/10/13.
// Copyright (c) 2013 Scott Robertson. All rights reserved.
//
#import <Foundation/Foundation.h>
@gwokudasam
gwokudasam / gist:365a496bf0ec7c48699bcb8de170d492
Created November 2, 2016 16:28 — forked from RiANOl/gist:1077723
AES128 / AES256 CBC with PKCS7Padding in PHP
<?
function aes128_cbc_encrypt($key, $data, $iv) {
if(16 !== strlen($key)) $key = hash('MD5', $key, true);
if(16 !== strlen($iv)) $iv = hash('MD5', $iv, true);
$padding = 16 - (strlen($data) % 16);
$data .= str_repeat(chr($padding), $padding);
return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC, $iv);
}
@gwokudasam
gwokudasam / Password.java
Created March 3, 2017 19:40 — forked from craSH/Password.java
A simple example Java class to safely generate and verify bcrypt password hashes for use in authentication systems.
/**
* Author: Ian Gallagher <igallagher@securityinnovation.com>
*
* This code utilizes jBCrypt, which you need installed to use.
* jBCrypt: http://www.mindrot.org/projects/jBCrypt/
*/
public class Password {
// Define the BCrypt workload to use when generating password hashes. 10-31 is a valid value.
private static int workload = 12;
@gwokudasam
gwokudasam / ContainerConfiguration.java
Created March 12, 2017 18:06 — forked from drissamri/ContainerConfiguration.java
Enable HTTPS in Spring Boot
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
securityConstraint.addCollection(collection);
@gwokudasam
gwokudasam / docker-file-glassfish.sh
Created July 30, 2017 14:48 — forked from agritsik/docker-file-glassfish.sh
Docker file for glassfish
# Glassfish container configured for Blog app
#
# VERSION 0.1
FROM glassfish
MAINTAINER Andrii Grytsyk
RUN apt-get update
RUN curl http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar -o glassfish/lib/mysql-connector-java-5.1.34.jar
<profiles>
<profile>
<id>docker</id>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<executions>
package zw.co.poscloud.utilities;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.net.URI;
/**
* @Author : gwokudasam
* @Date : 5/8/2017
@gwokudasam
gwokudasam / SQLServer-APIPost.sql
Created August 18, 2017 07:53 — forked from theorigin/SQLServer-APIPost.sql
SQL Server code to POST to an API
DECLARE @Object AS INT;
DECLARE @ResponseText AS VARCHAR(8000);
DECLARE @Body AS VARCHAR(8000) =
'{
"what": 1,
"ever": "you",
"need": "to send as the body"
}'
EXEC sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;
@gwokudasam
gwokudasam / install.sh
Created October 16, 2017 10:43 — forked from barbietunnie/install.sh
How to add Oracle JDBC driver in your Maven local repository
mvn install:install-file -Dfile={Path/to/your/ojdbc6.jar} -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar