This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RangeModule { | |
static class Range { | |
private static final boolean DEBUG = false; | |
private static final boolean BIASED_SPLIT = true; | |
private static final int MID_NON_MARKED = -1; | |
private static final int MID_ALL_MARKED = -2; | |
int startValue; | |
int endValue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install ghostscript | |
# predefined ebook compression | |
``` | |
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="output.pdf" input.pdf | |
``` | |
compress with resolution: | |
144 can be replaced to 288 or further, but since 144 is slightly worse than above default, and 288 has good quality but may still too big in some situations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Trait(impl=Counter.class) | |
interface CounterTrait { | |
public int countup(); | |
} | |
class Counter implements CounterTrait { | |
private int value = 0; | |
public int countup(){ | |
value++; | |
return value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ANSI_RESET="\u001B[0m" | |
ANSI_BLACK="\u001B[30m" | |
ANSI_LBLACK="\u001B[1;30m" | |
ANSI_RED="\u001B[31m" | |
ANSI_LRED="\u001B[1;31m" | |
ANSI_GREEN="\u001B[32m" | |
ANSI_LGREEN="\u001B[1;32m" | |
ANSI_YELLOW="\u001B[33m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Find the hardware ID of the mouse | |
Go to the mouse control panel | |
Select “Hardware” tab | |
Click “Properties” button | |
Select “Details” tab | |
From the drop-down list choose “Hardware IDs” | |
Save the VID*** entry ( e.g. VID_045E&PID_0039 ) | |
Find and change the corresponding configuration settings in the registry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
; Default color scheme | |
; for Windows command prompt. | |
; Values stored as 00-BB-GG-RR | |
[HKEY_CURRENT_USER\Console] | |
; BLACK DGRAY | |
"ColorTable00"=dword:00000000 | |
"ColorTable08"=dword:00808080 | |
; BLUE LBLUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import com.fasterxml.jackson.annotation.JsonSubTypes; | |
import com.fasterxml.jackson.annotation.JsonTypeInfo; | |
import com.fasterxml.jackson.annotation.JsonTypeName; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; | |
public class Zoo { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render.add(".x-num", Filter.formatedNum(121)); | |
interface Filter<S, T> { | |
public T convert(S s); | |
} | |
class NumFilter implements Filter<Integer, String>{ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var createDb = function(addr){ | |
console.log("connecting to", addr); | |
var client = new pg.Client(addr); | |
var qfn = client.query; | |
client.query = function(){ | |
var len = arguments.length; | |
if(typeof arguments[len-1] === "function"){ | |
var callback = arguments[len-1]; | |
arguments[len-1] = function(error, result){ | |
if(error){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function render(injector){ | |
var userId = injector.scope("query").get("userId", "int"); | |
var userProfile = injector.get("user");// object | |
var date = injector.get("date", injector.TYPE.date); | |
var idList = injector.get("ids", "long[]") | |
var idList = injector.get("ids", injector.TYPE.long.array) | |
} | |
function render(injector){ |
NewerOlder