Skip to content

Instantly share code, notes, and snippets.

@m1k3yfoo
m1k3yfoo / 2_Problem_Assignment.sql
Created October 3, 2018 01:09
[Oracle SQL Exercise 2] #Oracle #SQL
DROP TABLE TOY_STORE_1579349 CASCADE CONSTRAINTS;
DROP TABLE TOY_DTLS_1579349 CASCADE CONSTRAINTS;
DROP TABLE TOY_REL_1579349 CASCADE CONSTRAINTS;
--DROP SEQUENCE TOY_STORE_SN_1579349;
--DROP SEQUENCE TOY_DTLS_SN_1579349;
CREATE TABLE TOY_STORE_1579349
(
TOY_STORE_ID NUMBER(3) PRIMARY KEY,
TOY_STORE_NAME VARCHAR2(30) NOT NULL,
@m1k3yfoo
m1k3yfoo / 1_Problem_Assignment.sql
Last active October 3, 2018 01:10
[Oracle SQL Exercise 1] #Oracle #SQL
--1.
SET AUTO OFF;
DROP TABLE TOY_STORE_1579349 CASCADE CONSTRAINTS;
DROP TABLE TOY_DTLS_1579349 CASCADE CONSTRAINTS;
DROP TABLE TOY_REL_1579349 CASCADE CONSTRAINTS;
DROP SEQUENCE TOY_STORE_SN_1579349;
DROP SEQUENCE TOY_DTLS_SN_1579349;
CREATE TABLE TOY_STORE_1579349
@m1k3yfoo
m1k3yfoo / SecurityConfig.java
Last active September 30, 2018 22:26
[Spring Boot Security Config] #SpringBoot
package com.example.project;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@m1k3yfoo
m1k3yfoo / AuthenticationEntryPoint.java
Last active September 30, 2018 22:27
[Java Spring Boot AuthenticationEntryPoint] #SpringBoot
package com.example.project;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
@m1k3yfoo
m1k3yfoo / Hospital.java
Last active September 30, 2018 22:27
[Java Spring Boot Entity] #SpringBoot
package com.example.project;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Hospital {
public int getId() {
return id;
}
@m1k3yfoo
m1k3yfoo / HospitalService.java
Last active March 22, 2021 09:21
[Java Spring Boot Service] #SpringBoot
package com.example.project;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@m1k3yfoo
m1k3yfoo / restController.java
Last active September 30, 2018 22:26
[Java Spring Boot REST Controller] #SpringBoot
package com.example.project;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@m1k3yfoo
m1k3yfoo / consumeRestApi.java
Last active September 30, 2018 22:57
[Java Spring Boot] Consume REST API #SpringBoot
package com.example.project;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@m1k3yfoo
m1k3yfoo / stack.py
Created March 26, 2018 20:11
[Python Stack]
# Using lists as stacks
stack = [3, 4, 5]
stack.append(6) ## Same as push
stack.pop()
## Custom implementation of stack using LinkedList (See LinkedList)
class Element(object):
def __init__(self, value):
self.value = value
self.next = None
@m1k3yfoo
m1k3yfoo / BooleanTable.java
Created January 15, 2018 19:40
[Boolean Table] Generates all possible combinations of true/false for a boolean table #Java, #COMP671
public class BooleanTable
{
public static void main( String[] args ) {
final int n = 3;
final int col = (int) Math.pow( 2, n );
ArrayList<char[]> charMatrix = new ArrayList<>();
char[][] transposedMatrix = new char[n][col];
ArrayList<char[]> charArr;