Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View edalorzo's full-sized avatar

Edwin Dalorzo edalorzo

View GitHub Profile

Keybase proof

I hereby claim:

  • I am edalorzo on github.
  • I am edalorzopp (https://keybase.io/edalorzopp) on keybase.
  • I have a public key ASBbqjbS0EQZnXUoeusnFHNOpp8pXLXRmJkyjvMI0PFU9Ao

To claim this, I am signing this object:

@edalorzo
edalorzo / CmakeLists.txt
Created November 4, 2021 07:48
Configure PDCurses with CMake
cmake_minimum_required(VERSION 3.20)
project(MyProject)
set(CMAKE_CXX_STANDARD 20)
set(CURSES_LIBRARIES "libs")
include_directories("include")
link_directories("${CMAKE_SOURCE_DIR}/lib")
find_library(PDCURSES NAMES "pdcurses" HINTS "${CMAKE_SOURCE_DIR}/lib")
package com.dalorzo.nio;
import java.net.InetSocketAddress;
import java.net.StandardSocketOptions;
import java.nio.ByteBuffer;
import java.nio.channels.*;
public class SelectedSockets {
private static int PORT_NUMBER = 1234;
(function(){
var index = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'0','1','2','3','4','5','6','7','8','9','+','/','='];
var octets = ["","0","00","000","0000","00000","000000","0000000"];
var sixths = ["","00000","0000","000","00","0"];
var paddings = [[],[],[64,64],[],[64]];
unction Value(value){
this.value = value || 0;
}
Value.prototype.eval = function(){ return this; };
Value.prototype.valueOf = function(){ return this.value.valueOf(); };
Value.prototype.toString = function(){ return this.value.toString(); };
var createOperator = function(){
function reduce(oper){
asDecimal = function(){
var romans = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000 };
return function(roman){
return roman.split('').map(function(r){ return romans[r];})
.reduce(function(res,n,i,digits){
var prev = i > 0 ? digits[i-1] : 0;
return prev < n ? res + n - 2 * prev : res + n;
},0);
};
}();
import java.util.Objects;
import java.util.Arrays;
interface Operand {
Operand neg();
Operand add(Int that);
Operand add(Decimal that);
Operand add(Operand that);
Operand mult(Int that);
@edalorzo
edalorzo / .ignore
Created May 22, 2016 22:49
IntelliJ .ignore
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
@edalorzo
edalorzo / Factors.java
Created May 4, 2016 21:00
Largest Factor of a Number
public class Factors {
public static long factors(long n) {
long max = 0;
long d = 2;
while (n > 1) {
while (n % d == 0) {
max = Math.max(max, d);
n /= d;
}
@edalorzo
edalorzo / Palindrome.java
Created May 4, 2016 20:57
Largest Palindrome Number
public class Palindrome {
private static boolean isPalindrome(long n) {
return reverse(n) == n;
}
private static long reverse(long n) {
long rev = 0L;
while (n > 0) {
long d = n % 10;