Skip to content

Instantly share code, notes, and snippets.

@zaxebo1
zaxebo1 / LiferayHelper.java
Created August 22, 2018 08:40 — forked from farandal/LiferayHelper.java
Liferay Helper used in a Play Framework App to query the liferay json api
/* Author: Francisco Aranda (farandal@gmail.com) */
package controllers;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.entity.UrlEncodedFormEntity;
@zaxebo1
zaxebo1 / Api.java
Created August 22, 2018 08:39 — forked from farandal/Api.java
Play Framework Controller to read Liferay data using the LiferayHelper
package controllers;
import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import play.*;
import play.api.libs.json.JsValue;
import play.api.libs.json.Json;
import play.api.templates.*;
import play.mvc.*;
@zaxebo1
zaxebo1 / addTwo.wast
Created August 11, 2018 02:50 — forked from kanaka/addTwo.wast
Run wast (WebAssembly) in node
(module
(func $addTwo (param i32 i32) (result i32)
(i32.add
(get_local 0)
(get_local 1)))
(export "addTwo" (func $addTwo)))
@zaxebo1
zaxebo1 / gist:15c30c11ff2783e91df9c101f9e4ff92
Created March 1, 2018 00:35 — forked from Frozenfire92/gist:3627e38dc47ca581d6d024c14c1cf4a9
Install Scala and SBT using apt-get on Ubuntu 16.04 or any Debian derivative using apt-get
## Java
sudo apt-get update
sudo apt-get install default-jdk
## Scala
sudo apt-get remove scala-library scala
sudo wget http://scala-lang.org/files/archive/scala-2.12.1.deb
sudo dpkg -i scala-2.12.1.deb
sudo apt-get update
sudo apt-get install scala
@zaxebo1
zaxebo1 / README.md
Created October 28, 2017 15:28
How to enable SecureBoot with own keys in KVM and on a laptop (T450s)

UEFI SecureBoot on ArchLinux

For KVM and Laptop

Rationale

I want full control what boots the computer to avoid the so called evil maid attack. That requires setting SecureBoot with only my own keys.

Intro

@zaxebo1
zaxebo1 / clojure_is_for_type_b_personalities.md
Created October 21, 2017 13:16
Clojure is for type B personalities

The other day, I was wondering why Clojure fits my brain so well. I think I was relaxing on my old couch, drinking cheap beer, eating a gas station pastry, and drawing doodles on a stack of overdue bills I forgot to pay. Little did I realize, these things are all connected.

I have a hypothesis that people choose programming languages based on their personality. For the purposes of this write-up, I’ll use the well-known distinction between type A and type B people. This may be pop psychology stuff, but it’s convenient for my point so in the spirit of American politics I will treat it as fact.

Type A vs Type B

Type A people are very organized, competitive, punctual, and like to plan ahead. When I was a kid, these were the ones who had perfect grades, competed in track or swimming, and on top of that they were nice people so I couldn't even hate the fuckers. Type B people, on the other hand, are laid back and like to do things spontaneously. Like The Dude from The Big Lebowski, they are comfortable with

@zaxebo1
zaxebo1 / oneliners.scala
Created October 5, 2017 01:42 — forked from pgk/oneliners.scala
Scala one-liners
val factorialOfFive = {1 to 5}.toList.reduceLeft(_*_)

10 Scala One Liners to Impress Your Friends

Here are 10 one-liners which show the power of scala programming, impress your friends and woo women; ok, maybe not. However, these one liners are a good set of examples using functional programming and scala syntax you may not be familiar with. I feel there is no better way to learn than to see real examples.

Updated: June 17, 2011 - I'm amazed at the popularity of this post, glad everyone enjoyed it and to see it duplicated across so many languages. I've included some of the suggestions to shorten up some of my scala examples. Some I intentionally left longer as a way for explaining / understanding what the functions were doing, not necessarily to produce the shortest possible code; so I'll include both.

1. Multiple Each Item in a List by 2

The map function takes each element in the list and applies it to the corresponding function. In this example, we take each element and multiply it by 2. This will return a list of equivalent size, compare to o

@zaxebo1
zaxebo1 / spw
Created September 16, 2017 07:20 — forked from jolros/spw
Shell script to open SigmaPlot 12 using wine by itself or with a file passed in as an argument. See: http://blog.jolros.com/post/71709752383/running-sigmaplot-as-a-mac-os-x-application-using-wine
#!/usr/bin/env bash
export WINEDEBUG=-all
WINE=/usr/local/bin/wine
SPW=$HOME/.wine/drive_c/Program\ Files/SigmaPlot/SPW12/Spw.exe
if [ -z "$1" ]; then
"$WINE" "$SPW" >& /dev/null &
else
@zaxebo1
zaxebo1 / LList.as
Created August 8, 2017 22:53 — forked from inspirit/LList.as
Fast & Simple Dual Linked List
package ru.inspirit.asfeat.struct
{
/**
* Simple but fast Dual Linked List approach
* Core implementation idea grabbed from Linux Kernel C source
*
* @author Eugene Zatepyakin
*/
public final class LList
{