Skip to content

Instantly share code, notes, and snippets.

@calimaborges
calimaborges / App.java
Last active July 16, 2016 02:24
workflow-back-end-java-part3-deploy-com-heroku
package carlosborges.taskify;
import static spark.Spark.*;
public class App {
public static void main( String[] args ) {
String strPort = System.getenv("PORT") != null ? System.getenv("PORT") : "4567";
port(Integer.valueOf(strPort));
get("/", (req, res) -> "Hello World");
}
@calimaborges
calimaborges / App.java
Last active July 16, 2016 03:04
workflow-back-end-java-part4-teste-automatizado
package carlosborges.taskify;
import static spark.Spark.*;
public class App {
public static void main( String[] args ) {
App app = new App();
app.start(System.getenv("PORT"));
}
@calimaborges
calimaborges / App.java
Last active November 16, 2016 15:58
Simple HTTP Client
package carlosborges.httpclient;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
public class App {
public static void main( String[] args ) throws IOException {
@calimaborges
calimaborges / config.sh
Created July 17, 2017 16:35
Swap Memory Config Digital Ocean
# Configure swap memory
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
shutdown -r now
@calimaborges
calimaborges / webpack.config.js
Created July 21, 2017 20:22
Webpack Basic Config Example
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const webpack = require("webpack");
module.exports = {
devtool: "source-map",
entry: "./src/index.js",
output: {
filename: "[name].[hash].js",
@calimaborges
calimaborges / .block
Created April 22, 2020 01:54
fresh block
license: mit
#!/usr/bin/python
# -*- coding: utf-8 -*-
import websocket
import _thread as thread
import time
class Database:
dados = []