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 UIKit | |
class NRLabel : UILabel { | |
var textInsets = UIEdgeInsets.zero { | |
didSet { invalidateIntrinsicContentSize() } | |
} | |
override func textRect(forBounds bounds: CGRect, limitedToNumberOfLines numberOfLines: Int) -> CGRect { | |
let insetRect = UIEdgeInsetsInsetRect(bounds, textInsets) |
Use it with KindleGen
kindlegen dic.opf
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
// mynamespace is an object to use as a namespace | |
mynamespace = (function() { | |
// Variables in the namespace | |
var mynamespace = { | |
foo: "Yes, this is foo." | |
}; | |
// "Public" methods for the namespace | |
mynamespace.fooTwo = function() { |
JDBC client sends command to setup session when physical connection is established via a modified AUTH_ALTER_SESSION OCI attribute in the authentication phase.
If the JVM time zone is one of the magic constants in the oracle.sql.ZONEIDMAP
class and oracle.jdbc.timezoneAsRegion = true
(default) then AUTH_ALTER_SESSION looks like this (where Etc/UTC
is the default timezone picked up by the JVM)
ALTER SESSION SET TIME_ZONE='Etc/UTC' NLS_LANGUAGE='POLISH' NLS_TERRITORY='POLAND'
which can fail with
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/env python3 | |
import argparse | |
import base64 | |
import os | |
import re | |
import subprocess | |
import sys | |
from tempfile import mkstemp |
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
#!/usr/bin/env bash | |
# Convenience wrapper around VBoxManage for controlling VirtualBox virtual machines. | |
# | |
# Headless Ubuntu server gets stuck at boot menu on unsuccessful boots: | |
# http://serverfault.com/questions/243343/headless-ubuntu-server-machine-sometimes-stuck-at-grub-menu | |
function print_help { | |
echo "Usage: $(basename $0) [options] name" | |
echo "Easy control of VirtualBox virtual machines." | |
echo " -h Show this usage guide." |
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
<?php // tested with PHP 8.0.11 | |
$start = microtime(true); | |
const LOGIN_KEY_LEN = 20; | |
const MY_LOGIN_HEADER_LEN = 24; | |
const MAX_CIPHER_STORE_LEN = 4; | |
$raw = file_get_contents(__DIR__ . '/mylogin.cnf'); | |
$fp = 4; // skip null bytes |
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
""" | |
Implementation of "Pay to Witness Public Key Hash nested in BIP16 Pay to Script Hash" (P2WPKH-P2SH) address generation. | |
Described in BIP 141 (SegWit) https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#P2WPKH_nested_in_BIP16_P2SH | |
I.e.: Public key -> SegWit address | |
""" | |
import hashlib | |
from hashlib import sha256 |
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 asyncio | |
import threading | |
import random | |
def thr(i): | |
# we need to create a new loop for the thread, and set it as the 'default' | |
# loop that will be returned by calls to asyncio.get_event_loop() from this | |
# thread. | |
loop = asyncio.new_event_loop() |
OlderNewer