Skip to content

Instantly share code, notes, and snippets.

@kmila
kmila / JSimpleDiceMIDlet.java
Created June 25, 2021 19:00
old_palm_project.java
package net.sf.jsimpledice;
import java.io.IOException;
import java.util.Random;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Command;
public static UUID sequentialId(int id) {
Assert.isTrue(id >= 0, "[Assertion failed] - negative id");
return UUID.fromString(String.format("%08d-%04d-%04d-%04d-%012d", Math.min(id, 99999999), 0, 0, 0, 0));
}
public static String asString(UUID uuid) {
return String.format("%016x", uuid.getMostSignificantBits());
}
@kmila
kmila / https-server.py
Created May 10, 2017 10:25
py3 https local server
import http.server, ssl
server_address = ('localhost', 4443)
httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket,
server_side=True,
certfile='localhost.pem',
ssl_version=ssl.PROTOCOL_TLSv1)
httpd.serve_forever()
@kmila
kmila / README.md
Created November 11, 2015 18:57 — forked from nitaku/README.md
Minimal JSON HTTP server in python

A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.

python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
Verifying that +kmila is my blockchain ID. https://onename.com/kmila
import imaplib
M = imaplib.IMAP4_SSL('imap.oi.com.br')
if (M.login('<USER_TO_TEST>@oi.com.br','PASSWORD')[0] != 'OK'): exit("no conn")
c = (M.select('Inbox'))[1][0]
if (c != '0'):print c
typ, data = M.search(None, '(SEEN)')
for num in data[0].split():
typ, data = M.fetch(num, '(RFC822)')
print('Message %s\n%s\n' % (num, data[0][1]))
@kmila
kmila / gist:1d30c7d8d6244709ecf3
Created April 24, 2015 17:24
xfce icon fallback
[Icon Theme]
Name=Paper
Comment=A simple and modern icon theme.
Inherits=Paper,elementary-xfce-dark
@kmila
kmila / changeapk.md
Created January 27, 2015 12:22
changeapk.md
keytool -genkey -v -keystore myapk.key -alias myapkkey -keyalg RSA -keysize 2048 -validity 10000

[changeit] [yes]

  1. Edit apk
  2. Delete META-INF
  3. Save
#!/bin/bash
#
# -------------------
# BEGIN CONFIGURATION
# -------------------
DEBUG=0
CMD="curl -ks"
URI="https://ENV_URI"
; A REPL-based, annotated Seesaw tutorial
; Please visit https://github.com/daveray/seesaw for more info
;
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers
; Seesaw's basic features and philosophy, but only scratches the surface
; of what's available. It only assumes knowledge of Clojure. No Swing or
; Java experience is needed.
;
; This material was first presented in a talk at @CraftsmanGuild in
; Ann Arbor, MI.