# 通常bashバージョン
alias nippo="curl -sL \"https://gist.githubusercontent.com/umihico/4b131c0a9a521df40abcde701c90cc67/raw/nippo.sh?v=$(date +'%s')\" | bash -e"
# エラーした人向けdocker利用バージョン
This file contains hidden or 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 { round } from "mathjs" | |
| import { average, sampleCovariance } from "simple-statistics" | |
| const sum = (array: number[]) => { | |
| return array.reduce((a, b) => a + b, 0) | |
| } | |
| const weightAverage = (prices: number[], weights: number[]) => { | |
| const wSum = sum(weights) | |
| const weightedPrices = prices.map((price, index) => { |
This file contains hidden or 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 { variance } from "mathjs" | |
| import { average, linearRegression, sampleCovariance } from "simple-statistics" | |
| describe("line regression test", () => { | |
| /** | |
| * https://whyitsso.net/math/statistics/statistics1.html | |
| */ | |
| test("実験", () => { | |
| const data = [ | |
| [1, 1], |
This file contains hidden or 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
| require "google/apis/youtube_v3" | |
| # rails r 'puts YoutubeHelper.search' | |
| # Youtubeのdescriptionの先頭に「提供」と「(引数)」がついている動画を検索する | |
| module YoutubeHelper | |
| class << self | |
| def service | |
| youtube_service = Google::Apis::YoutubeV3::YouTubeService.new |
This file contains hidden or 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 { linearRegression } from "simple-statistics" | |
| /** | |
| * 重み付き線形回帰 | |
| * https://chemstat.hatenablog.com/entry/2021/01/23/194405 | |
| * @param pricesY | |
| * @param pricesX | |
| * @param weights | |
| * @returns expectedY = intercept + slope * x | |
| */ |
This file contains hidden or 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 cluster from "cluster" | |
| import { cpus } from "os" | |
| export const multiProcessHandler = async ( | |
| jobConsumer: (job: string) => Promise<void>, | |
| JobQueueGenerator: () => Generator<string, void, unknown>, | |
| ) => { | |
| if (cluster.isPrimary) { | |
| console.log(`Primary ${process.pid} is running`) |
This file contains hidden or 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://gist.github.com/umihico/3a19974ccb251a01dc870fe39b09749f | |
| function aws-sub() { | |
| aws-main --incognito | |
| } | |
| function aws-main() { | |
| if [ "$1" = "--incognito" ]; then # Sign-out current user | |
| open -na 'Google Chrome' --args --incognito "https://signin.aws.amazon.com/oauth?Action=logout&redirect_uri=https://aws.amazon.com" # Mac, OSX | |
| else |
This file contains hidden or 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
| Host limadocker | |
| HostName localhost | |
| Port 60006 | |
| User lima | |
| NoHostAuthenticationForLocalhost yes |
This file contains hidden or 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 public.ecr.aws/lambda/python:3.8 | |
| RUN yum install -y amazon-linux-extras | |
| RUN cp -r /lib/python2.7/site-packages/amazon_linux_extras /var/lang/lib/python3.8/site-packages/ | |
| # TEST COMMAND -> RUN amazon-linux-extras install -y mate-desktop1.x |
This file contains hidden or 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
| cd $(mktemp -d); while true; do seq 1000 | xargs -P 1000 -I NUM sh -c 'ssh-keygen -t ed25519 -f NUM.pem -N "" -C "" > /dev/null && if grep -vi umihico NUM.pem.pub > /dev/null; then rm NUM.pem NUM.pem.pub;fi' ; if find . -mindepth 1 | read; then for f in *.pem.pub; do echo $f >> files.txt; done; test -f files.txt && head -n1 files.txt | xargs -I F curl -s -X POST -d '{"text":"F"}' https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYYYY/zzzZZZzZzzZzzZZzz; break; fi ; date ; done |
NewerOlder