Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 PIDController | |
{ | |
constructor(Kp, Ki, Kd) { | |
this.Kp = Kp; | |
this.Ki = Ki; | |
this.Kd = Kd; | |
this.deltaError = 0; | |
this.sumError = 0; | |
this.lastError = 0; |
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 | |
CA=/etc/openvpn/keys/ca.crt | |
CERT=/etc/easy-rsa/keys/$1.crt | |
KEY=/etc/easy-rsa/keys/$1.key | |
TLS_AUTH=/etc/openvpn/keys/ta.key | |
cat client.ovpn \ | |
| sed -e '/<ca><\/ca>/{' -e 'i <ca>' -e "r $CA" -e 'a </ca>' -e 'd' -e '}' \ | |
| sed -e '/<key><\/key>/{' -e 'i <key>' -e "r $KEY" -e 'a </key>' -e 'd' -e '}' \ |
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
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
#[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)] |
NewerOlder