Skip to content

Instantly share code, notes, and snippets.

View harukaeru's full-sized avatar
😃
This is a smile.

haᵲuʞaͣeͤͣͤͣru harukaeru

😃
This is a smile.
View GitHub Profile
@harukaeru
harukaeru / generate.py
Created April 2, 2023 08:30
GitHubのファイルをダウンロードする
import sys
import requests
def convert_github_url_to_raw(url):
raw_url = url.replace("github.com", "raw.githubusercontent.com")
raw_url = raw_url.replace("/blob", "")
return raw_url
def download_and_save(url, filename):
raw_url = convert_github_url_to_raw(url)
[Adblock Plus 1.1]
! Version: 202304011249
! Title: MyEasyPrivacy
! Last modified: 01 Apr 2023 12:49 UTC
! Expires: 4 days (update frequency)
! *** easylist:template_header.txt ***
!
! Please report any unblocked adverts or problems
! in the forums (https://forums.lanik.us/)
! or via e-mail (easylist@protonmail.com).
import matplotlib
matplotlib.rcParams['font.family'] = 'Hiragino Maru Gothic Pro'
import matplotlib.pyplot as plt
import numpy as np
data = [{
"name": "東京の殺人発生率(認知件数をもとに計算)",
"rate": "8.89/1000000",
"src": "http://grading.jpn.org/Divy2502002.html"
// ==UserScript==
// @name Change hl Query To Japanese When Searching Japanese Letters
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.google.com/search*
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// ==/UserScript==
// ==UserScript==
// @name Change Default To "Following" Tab, Not "For You" Tab
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
@harukaeru
harukaeru / my_kernprof.py
Created September 11, 2022 05:10
profile the lines after tampering the original file
func_wrapper_line = '@profile\ndef main():\n'
lines = list(open('main.py').readlines())
insert_pos = 0
if lines[0].startswith('#!'):
insert_pos = 1
generated_lines = []
for i, line in enumerate(lines):
if i == insert_pos:
@harukaeru
harukaeru / reverse.js
Last active June 9, 2022 14:16
Reverse calculated rank to distribution percentage in github-readme-stats
const debug = v => { console.log('debug', v); return v; }
// https://github.com/anuraghazra/github-readme-stats/blob/4e2f631f956a49efde2bc5883e5ce51891621c44/src/getStyles.js#L5
const reverseProgress = (progress) => {
const radius = 40;
const c = Math.PI * (radius * 2);
return 100 * (progress / c)
}
@harukaeru
harukaeru / add_paths.sh
Last active May 2, 2022 08:50
The script that makes python installed from Homebrew available in C/C++ on Mac OS X
$ ln -s /usr/local/Cellar/python@3.10/3.10.1/Frameworks/Python.framework/Versions/3.10/include/python3.10/* /usr/local/include
$ which gj
gj: aliased to /usr/local/Cellar/gcc/11.2.0_3/bin/g++-11 -D GLIBCXX_DEBUG -Wl,-demangle -std=c++17 -Wall -Werror -fsanitize=undefined -O2 -g
$ which aa
aa () {
if [[ -z $1 ]]
then
./a.out
else
@harukaeru
harukaeru / launch.json
Created April 16, 2022 05:27
default launch.json for VSCode & C++ on Mac OS X
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "clang++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
@harukaeru
harukaeru / color_gradation_generator.py
Last active February 15, 2020 04:59
color-gradation-generator
class Color:
def __init__(self, red, green, blue):
self.red = red
self.green = green
self.blue = blue
def __add__(self, other):
return Color(
self.red + other.red,
self.green + other.green,