Skip to content

Instantly share code, notes, and snippets.

View InfoSec812's full-sized avatar

Deven Phillips InfoSec812

View GitHub Profile
@InfoSec812
InfoSec812 / 1. MyWeatherApp
Last active December 18, 2015 21:59
Several snippets which can be used to build a basic Android application.
public class MainActivity extends Activity {
protected static final String TAG = "MainActivity" ;
// Define protected instances of the needed UI elements
protected ProgressBar busyIndicator = null ;
protected TextView weatherData = null ;
@Override
protected void onCreate(Bundle savedInstanceState) {
@InfoSec812
InfoSec812 / gist:6541526
Created September 12, 2013 18:04
Mapping a stored procedure in JPA 2.0
@Entity(name="com.hps.mdm.legacy.domain.person")
@Table(name = "PERSON")
@SqlResultSetMapping(name="myMapping", entities={Person.class, Agent.class, Contact.class})
@NamedNativeQuery(name="PersonPLSQL", query="CALL STORED PROCEDURE", resultSetMapping="myMapping")
public @Data class Person implements Serializable {
private static final long serialVersionUID = 1L;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Id
@Basic(optional = false)
@InfoSec812
InfoSec812 / ListGists.java
Created November 20, 2014 13:49 — forked from jtulach/ListGists.java
Networking with JSON and Java
package dew.demo.gists;
import java.util.Arrays;
import net.java.html.json.*;
@Model(className="UI", properties={
@Property(name="user",type=String.class),
@Property(name="current",type=String.class),
@Property(name="names", type=String.class, array = true),
@Property(name="gists",type=Gist.class, array = true)
@InfoSec812
InfoSec812 / swagger-annotations.java
Last active August 29, 2015 14:20
Showing how to use Swagger annotations to mark a parameter as required.
@PUT
@Path("/{id}")
@Produces(value = {"application/json", "application/xml"})
@ApiOperation(value = "Update/Modify ToDo entity specified by 'id'", produces = "application/json, application/xml",
response = ToDo.class, consumes = "application/xml, application/json")
@ApiResponses({
@ApiResponse(code = SC_INTERNAL_SERVER_ERROR, message = "SERVER ERROR"),
@ApiResponse(code = SC_BAD_REQUEST, message = "Invalid ID value")
})
public ToDo updateToDo(@ApiParam( value = "The unique ID of the ToDo entity", name = "id", required = true) @PathParam("id") Long id,
@InfoSec812
InfoSec812 / gist:a45eb3b7ba9d4b2a9b94
Last active November 3, 2022 16:56
SSL Config Example For Vert.x 3.0.0
package com.zanclus.socialshell;
import com.zanclus.socialshell.utils.AbstractLoggingVerticle;
import static io.vertx.ext.auth.shiro.LDAPAuthRealmConstants.*;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Verticle;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.core.json.JsonObject;
@InfoSec812
InfoSec812 / WebServer.java
Last active August 29, 2015 14:26
A basic example of using vertx-web and it's "router" functionality to handle HTTP requests.
package com.mycompany.vertx.demo;
import io.vertx.core.AbstractVerticle;
import io.vertx.ext.web.Router;
public class WebServer extends AbstractVerticle {
@Override
public void start() throws Exception {
Router router = Router.router(vertx);
@InfoSec812
InfoSec812 / Main.java
Created July 28, 2015 19:21
Using the Main.java class to deploy the WebServer verticle.
package com.mycompany.vertx.demo;
import io.vertx.core.AbstractVerticle;
/**
*
*/
public class Main extends AbstractVerticle {
@Override
@SpringBootApplication
@EnableJpaRepositories
@EnableTransactionManagement
@Slf4j
public class Application {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Application.class, args);
System.out.println("Let's inspect the beans provided by Spring Boot:");
@InfoSec812
InfoSec812 / klein_peer_credentials.py
Last active February 29, 2016 17:39
Using SO_PEERCRED inside of twisted/klein on a unix domain socket.
import struct
from socket import SOL_SOCKET, socket
import grp
import pwd
from klein.app import Klein
class MyApp(object):
"""
An example Klein application to test unix domain socket peer credential checking