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
use std::sync::Arc; | |
type Log = Box<dyn Fn(&str)>; | |
struct OpenLibrary { | |
pub log: Log, | |
} | |
struct OpenDevice { | |
library: Arc<OpenLibrary>, |
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 selenium | |
import selenium.webdriver | |
options = selenium.webdriver.chrome.options.Options() | |
options.binary_location = '/home/aib/tmp/chrome-linux/chrome' | |
options.add_argument('--user-data-dir=/tmp/selenium_data_dir') | |
options.add_argument('--profile-directory=SeleniumProfile') | |
service = selenium.webdriver.chrome.service.Service(executable_path='/home/aib/tmp/chromedriver_linux64/chromedriver') |
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 hexdump(buffer, bytesPerRow) { | |
bytesPerRow = bytesPerRow || 16; | |
const hexDigits = "01234567890abcdef"; | |
var str = ""; | |
for (var addr = 0; addr < buffer.length; addr += bytesPerRow) { | |
var rowStr = ("0000" + addr.toString(16)).slice(-4) + ":"; | |
for (var i = addr; i < addr + bytesPerRow; i++) { | |
if (i < buffer.length) { | |
rowStr += " " + hexDigits[(0xf0 & buffer[i]) >> 4] + hexDigits[0x0f & buffer[i]]; |
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 python | |
import math | |
import pygame | |
import random | |
import rtmidi | |
from rtmidi.midiconstants import * | |
import time | |
TAU = 2 * math.pi |
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
TWAIN 2.5 Operation Triplets (§7) | |
A -> SM | |
DG_CONTROL DAT_IDENTITY MSG_CLOSEDS 7-58 duplicated (SM -> S) | |
DG_CONTROL DAT_IDENTITY MSG_GETDEFAULT 7-61 | |
DG_CONTROL DAT_IDENTITY MSG_GETFIRST 7-62 | |
DG_CONTROL DAT_IDENTITY MSG_GETNEXT 7-64 | |
DG_CONTROL DAT_IDENTITY MSG_OPENDS 7-66 duplicated (SM -> S) | |
DG_CONTROL DAT_IDENTITY MSG_SET 7-69 | |
DG_CONTROL DAT_IDENTITY MSG_USERSELECT 7-70 | |
DG_CONTROL DAT_PARENT MSG_CLOSEDSM 7-78 |
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
-- | |
-- Table structure for table "site_cities" | |
-- | |
DROP TABLE IF EXISTS "site_cities" CASCADE; | |
CREATE TABLE "site_cities" ( | |
"city_id" serial NOT NULL, | |
"city_name" varchar(20) NOT NULL, | |
"plate_code" smallint NOT NULL, | |
"area_code" smallint NOT NULL, | |
"lat" decimal(20,8) NOT NULL, |
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
#[derive(Debug)] | |
#[derive(Copy, Clone)] | |
pub struct Vec3<T> { | |
pub x: T, | |
pub y: T, | |
pub z: T | |
} | |
impl<T> Vec3<T> { | |
pub fn new(x:T, y:T, z:T) -> Vec3<T> { |
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 logging | |
LEVELS = { | |
logging.CRITICAL: { 'label': "CRIT ", 'style-pre': "\033[95m", 'style-post': "\033[0m" }, | |
logging.ERROR: { 'label': "ERROR", 'style-pre': "\033[91m", 'style-post': "\033[0m" }, | |
logging.WARNING: { 'label': "WARN ", 'style-pre': "\033[93m", 'style-post': "\033[0m" }, | |
logging.INFO: { 'label': "INFO ", 'style-pre': "\033[97m", 'style-post': "\033[0m" }, | |
logging.DEBUG: { 'label': "DEBUG", 'style-pre': "\033[37m", 'style-post': "\033[0m" }, | |
logging.NOTSET: { 'label': " ", 'style-pre': "\033[90m", 'style-post': "\033[0m" }, | |
} |
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 functools | |
import itertools | |
import operator | |
def groupings(sum_): | |
if sum_ == 0: | |
return [()] | |
else: | |
return [(i,) + subg for i in range(1, sum_ + 1) for subg in groupings(sum_ - i)] |
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 collections | |
import importlib | |
import inspect | |
import sys | |
MODULES = """\ | |
string | |
re | |
difflib | |
textwrap |
NewerOlder