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 java.io.*; | |
public class ByteOutputStream extends FileOutputStream { | |
byte buffer; | |
byte pos; | |
public ByteOutputStream(File file) throws FileNotFoundException { | |
super(file); | |
buffer = 0x00; |
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 | |
# speedtest.sh [host] | |
ssh $1 iperf3 -s > /dev/null 2>&1 & sshpid=$$ | |
sleep 5 | |
iperf3 -c $1 | |
kill $sshpid |
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 -S deno run --allow-run --allow-write | |
import sh from 'https://denopkg.com/wtfaremyinitials/deno-shell-tag/mod.js' | |
// TODO: integrate clubhouse api for ticket titles, blockers, and today | |
const LOW_MINUTES_THRESHOLD = 10 | |
const SECONDS_TO_MINUTES = 1 / (1000 * 60) | |
const IGNORE_TAGS = ['billable', 'pingthings', 'standup', 'work'] | |
const TICKET_REGEX = /ch(\d{4})/ |
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
async function* openFifo(path) { | |
while(true) { | |
let file = await Deno.open(path, 'r') | |
let data = await Deno.readAll(file) | |
yield data | |
} | |
} |
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
macro_rules! enum_with_str_representation { | |
(enum $enum_name:ident { | |
$($variant:ident => $nice_name:expr,)+ | |
}) => { | |
#[derive(Debug, PartialEq, Eq, Clone, Hash)] | |
enum $enum_name { | |
$($variant),+ | |
} | |
impl ::std::fmt::Display for $enum_name { |
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 React from 'react' | |
import hyperx from 'hyperx' | |
export const h = function hyperz() { | |
let scope = this | |
if (!Array.isArray(arguments[0])) { | |
let newScope = arguments[0] | |
return hyperz.bind(Object.assign({}, scope, newScope)) | |
} |
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
command! w w>>chat|enew! | |
cabbrev w <c-r>=(getcmdtype()==':' && getcmdpos()==1 ? 'W' : 'w')<CR> |
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
# run at login with `sudo defaults write com.apple.loginwindow LoginHook path/to/caps_to_esc.sh` | |
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' > /dev/null 2>&1 |
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
# must be run as root | |
COMPUTER_NAME=name | |
scutil --set ComputerName $COMPUTER_NAME | |
scutil --set HostName $COMPUTER_NAME | |
scutil --set LocalHostName $COMPUTER_NAME | |
defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $COMPUTER_NAME |
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
// from: https://medium.com/@piyopiyo/how-to-get-erc20-token-balance-with-web3-js-206df52f2561 | |
let tokenAddress = "REPLACE_WITH_ERC20_TOKEN_ADDRESS"; | |
let walletAddress = "REPLACE_WITH_WALLET_ADDRESS"; | |
// The minimum ABI to get ERC20 Token balance | |
let minABI = [ | |
// balanceOf | |
{ | |
"constant":true, |
NewerOlder