Navigation Menu

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 / install.sh
Created February 23, 2021 11:03 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@gwokudasam
gwokudasam / .htaccess
Created October 3, 2019 06:54 — forked from sunuazizrahayu/.htaccess
Force https://www on Codeigniter with .htaccess
RewriteEngine on
#Force WWW
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
@gwokudasam
gwokudasam / .htaccess
Created October 3, 2019 06:53 — forked from hectorromo/.htaccess
www & https
RewriteEngine on
### WWW & HTTPS
# Force www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Force non-www:
@gwokudasam
gwokudasam / wildfly-install.sh
Created March 12, 2018 09:47 — forked from sukharevd/wildfly-install.sh
Script to install JBoss Wildfly 10.x as service in Linux
#!/bin/bash
#title :wildfly-install.sh
#description :The script to install Wildfly 10.x
#more :http://sukharevd.net/wildfly-8-installation.html
#author :Dmitriy Sukharev
#date :2016-06-18T02:45-0700
#usage :/bin/bash wildfly-install.sh
#tested-version1 :10.0.0.CR3
#tested-distros1 :Ubuntu 15.10; Debian 7,8; CentOS 7; Fedora 22
#tested-version2 :10.0.0.Final
@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
@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 / 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
@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 / 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 / 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);
}