Skip to content

Instantly share code, notes, and snippets.

View scorredoira's full-sized avatar

Santiago Corredoira Lascaray scorredoira

View GitHub Profile
namespace A {
export class PeriodPicker extends Input {
private closeIconPanel: Control
input: HTMLInputElement
popup: Popup
constructor() {
super("A-PeriodPicker")
import * as web from "lib/web"
import * as env from "lib/env"
import * as orm from "lib/orm"
let upgrader = websocket.newUpgrader()
let webSockets: WebSocketManager
function init() {
webSockets = new WebSocketManager()
}
@scorredoira
scorredoira / bench.md
Last active March 7, 2021 23:13
Hello world in Dune, Go and C

HTTP Hello world in Dune, Go and C

Dune

let server = http.newServer()
server.address = ":8081"
server.handler = (w, r) => w.write("Hello, World!")
server.start()
package main
import (
"fmt"
)
func main() {
var i uint32
// set the first 5 bits with the num 12
export class Control {
readonly element: HTMLElement
protected children: Control[]
private _parent: Control;
constructor(element: string | HTMLElement, className?: string, parent?: Control, content?: string | Control) {
if (typeof element === "string") {
element = document.createElement(element)
}
namespace UI {
const subtitle = T("@@or drop a file to upload")
interface Position {
x: number
y: number
}
interface Bounds {
namespace S {
let formats: any = {}
let systemLocation = Intl.DateTimeFormat().resolvedOptions().timeZone
export class Date {
private _date: globalThis.Date
private _location: string
private _locationOffset: number
https://www.mets-blog.com/java-pos-thermal-printer-example/
https://stackoverflow.com/questions/17505070/printing-reciepts-with-thermal-printer-in-java/39381849
Here it is, usb pos thermal printer solution. It is purely in java. The only condition is that your printer is recognized by the OS as a printer 🙂
That means it will show up in the printers list and queue. Getting the latest drivers should do it.
And as a bonus it works in Windows, Mac, Linux(yes tried in all of them). You are welcome Internet.
Note: If anyone knows how to draw stuff and change fonts with pos commands will be great. Make small tutorial in java.
PrinterService.java
@scorredoira
scorredoira / game.ts
Created July 26, 2020 19:14
terminal test game
const TUNNEL_HEIGHT = 0.26
const MAIN_LOOP_DELAY_MILIS = 15
const START_DELAY_MILLIS = 1000
export function main() {
terminal.init()
defer(() => terminal.close())
let size = terminal.size()
let map = generateMap(size.width, size.height)
@scorredoira
scorredoira / tlsproxy.ts
Created May 23, 2020 20:35
TLS Reverse proxy
import "stdlib/native"
export function main() {
let url = http.parseURL("https://example.com/")
let proxy = httputil.newSingleHostReverseProxy(url)
let server = http.newServer()
server.addressTLS = ":9999"
let c = tls.generateCert()
let tlsConf = tls.newConfig(true)