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
{ | |
"keymaps": [ | |
[ | |
{"code": 20, "label": {"base": "q", "shifted": "Q"}}, | |
{"code": 26, "label": {"base": "w", "shifted": "W"}}, | |
{"code": 8, "label": {"base": "e", "shifted": "E"}}, | |
{"code": 21, "label": {"base": "r", "shifted": "R"}}, | |
{"code": 23, "label": {"base": "t", "shifted": "T"}}, | |
{ | |
"code": 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
import collections | |
class Multiset(collections.Counter): | |
def add(self, elem): | |
self[elem] += 1 | |
def remove(self, elem): | |
self[elem] -= 1 | |
if self[elem] == 0: | |
del self[elem] | |
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 | |
# color pager | |
# run command with appropriate color option (like --color-output for 'jq') and pipe to a pager | |
if which lv >/dev/null 2>&1 | |
then | |
pager=(lv -c) | |
else | |
pager=(less -R) | |
fi |
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
// https://leetcode.com/problems/median-of-two-sorted-arrays/description/ | |
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"runtime" | |
"sort" | |
"time" | |
) |
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 | |
set -ue | |
voices=($(say -v '?' | egrep 'en_US|en_UK' | egrep -v 'Pipe Organ|Bubbles|Bells|Bahh|Hysterical|Boing|Bad|Albert'| awk '{print $1}')) | |
nr_voices=${#voices[@]} | |
correct=0 | |
wrong=0 | |
RANDMAX=32767 |
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
with open("filename.txt") as f: | |
lineIdx = 0 | |
for line in f: | |
if lineNo %2 == 1: | |
print(lastline + "の" + line) | |
else: | |
lastline = line | |
lineIdx += 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
// https://leetcode.com/problems/n-queens-ii | |
func totalNQueens(n int) int { | |
ans := []int{0,1,0,0,2,10,4,40,92,352,724,2680,14200,73712,365596,2279184,14772512,95815104,666090624,4968057848,39029188884,314666222712,2691008701644,24233937684440,227514171973736,2207893435808352,22317699616364044,234907967154122528} | |
return ans[n] | |
} |
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 sys, os, re | |
class AutoLoader(): | |
def __init__(self, nickname, modulename): | |
self.nickname = nickname | |
self.modulename = modulename | |
def __getattr__(self, methodname): | |
g = globals() | |
g[self.nickname] = __import__(self.modulename) |
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
//This is lab2 the vending machine creat by Kei Kato. | |
#include <iostream> | |
#include <iomanip> | |
#include <cstdlib> | |
#define PLURAL(variable, word) \ | |
variable << word << (variable > 1 ? "s" : "") | |
using namespace std; |
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
int analogReadPS(uint8_t pin) { | |
ACSR &= ~ _BV(ACD); // Enablethe analog comparator | |
bitClear(PRR, PRADC); // power up ADC | |
ADCSRA |= _BV(ADEN); | |
unsigned int reading = analogRead(pin); | |
ADCSRA &= ~_BV(ADEN); | |
bitSet(PRR, PRADC); // power down ADC | |
ACSR |= _BV(ACD); //Disable the analog comparator |
NewerOlder