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.security.InvalidKeyException; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.SignatureException; | |
import java.util.Formatter; | |
import javax.crypto.Mac; | |
import javax.crypto.spec.SecretKeySpec; | |
/** |
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 <Cocoa/Cocoa.h> | |
@interface MyTextView : NSView <NSTextInput, NSTextInputClient> { | |
NSMutableAttributedString *_text; | |
NSRange _selectedRange; | |
NSRange _markedRange; | |
} | |
@end |
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
# Cooper, Keith D.; Harvey, Timothy J.; and Kennedy, Ken (2001). A Simple, Fast Dominance Algorithm | |
# http://www.cs.rice.edu/~keith/EMBED/dom.pdf | |
# | |
# Computing minimal SSA using dominance frontiers | |
# http://en.wikipedia.org/wiki/Static_single_assignment_form#Computing_minimal_SSA_using_dominance_frontiers | |
# | |
# Dominator (graph theory) | |
# http://en.wikipedia.org/wiki/Dominator_(graph_theory) | |
# | |
require 'set' |
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
# Y Combinator in Python | |
# See <http://d.hatena.ne.jp/nowokay/20090409#1239268405> | |
true = lambda x: lambda y: x | |
false = lambda x: lambda y: y | |
# `bool` to `true|false` | |
# | |
# >>> boolean(3 < 4)(2)(5) | |
# 2 |
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
|Wall|_ | |
.. |Wall| replace:: ``-Wall`` | |
.. _Wall: http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html#index-Wall-234 | |
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
Sun Nov 20 14:40:09 2022 whisper.prof | |
5912402 function calls (5549784 primitive calls) in 709.208 seconds | |
Ordered by: cumulative time | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
1983/1 0.038 0.000 709.211 709.211 {built-in method builtins.exec} | |
1 0.086 0.086 709.195 709.195 prof_whisper.py:1(<module>) | |
1 0.024 0.024 673.748 673.748 transcribe.py:19(transcribe) |
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 strict; | |
use warnings; | |
use Test::More qw(no_plan); | |
sub uint16_int16 { | |
my $v = shift; | |
return ($v & 0x8000) ? -((~$v & 0xffff) + 1) : $v; | |
} |
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
combinations = set() | |
for x in range(1, 37): | |
for y in range(1, 37): | |
for z in range(1, 37): | |
if x * y * z == 36: | |
sisters = [x, y, z] | |
sisters.sort(reverse=True) | |
sisters = tuple(sisters) | |
if sisters not in combinations: |
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
pub enum Foo { | |
A, | |
B, | |
} | |
impl Foo { | |
pub fn variants() -> impl Iterator<Item = Foo> { | |
array::IntoIter::new([Self::A, Self::B]) | |
} | |
} |
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
/* | |
MIT License | |
Copyright (c) 2021 Takanori Ishikawa | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
NewerOlder