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 / coverall_github.js
Last active September 14, 2017 07:43
You can directly access to a page of code coverage in Coveralls from GitHub Pull Request Page.
/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.construc
@harukaeru
harukaeru / connect.sh
Last active October 17, 2017 12:41
Connect to VPN on Mac OS X (10.13)
current_network_name=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}')
if [ $current_network_name == "ICHINEN-PC_Network" ]; then # You should replace this Network name with your own.
VPN="8EEFE99B-582D-4E3E-B08B-F40030C4BB39" # You can get this VPN name from "scutil --nc list"
if scutil --nc status "$VPN" | grep -q Connected; then
scutil --nc stop "$VPN"
else
scutil --nc start "$VPN" --secret vpn # this 'secret' is depended of your environment.
fi
fi
@harukaeru
harukaeru / foo.js
Created November 21, 2017 12:20
ES6
const wait = time => new Promise(resolve => setTimeout(resolve, time))
const x = (...args) => {
console.log('-----------------------------')
console.log(...args)
}
wait(1000)
.then(() => fetch('https://www.google.co.jp', { header: "same-origin" }))
.then(response => response.text())
.then(text => x('this is the response', text))
@harukaeru
harukaeru / extract.js
Created November 4, 2018 11:52
Extract data as TSV from glossary in Weblio
var tdFunctions = {
0: td => td.getAttribute('title'),
1: td => td.innerHTML,
2: td => td.querySelector('.tngMainTIML').innerHTML,
3: td => td.querySelector('.tngMainTSRHB').textContent,
}
var trFilter = tr => {
return tr.classList.contains('tngMainTrOn');
}
@harukaeru
harukaeru / toAnki.py
Created November 4, 2018 11:55
Assemble data for Anki from normalized TSV file specialized in Weblio.
# python toAnki.py /path/to/your_tsv_file.tsv
import re
import sys
alphabet = r'[A-Za-z ,\.\[\]"\']'
alphabet = re.compile(alphabet)
quotation = r'- .*$'
quotation = re.compile(quotation)
@harukaeru
harukaeru / product.py
Created November 8, 2018 07:37
Create a table from linear texts which contain columns and rows
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("filename", help="You set here files to parse.")
parser.add_argument(
"--transpose",
default=False, action='store_true',
help="Exchange column header and row header."
)
args = parser.parse_args()
This file has been truncated, but you can view the full file.
SYSCALL(args) = return
dtrace: 592513 dynamic variable drops with non-empty dirty list
open("/dev/dtracehelper\0", 0x2, 0xFFFFFFFFEDFE5070) = 3 0
ioctl(0x3, 0x80086804, 0x7FFEEDFE4E80) = 0 0
close(0x3) = 0 0
access("/AppleInternal/XBS/.isChrooted\0", 0x0, 0x0) = -1 Err#2
bsdthread_register(0x7FFF79A40408, 0x7FFF79A403F8, 0x2000) = 1073742047 0
sysctlbyname(kern.bootargs, 0xD, 0x7FFEEDFE4220, 0x7FFEEDFE4218, 0x0) = 0 0
issetugid(0x0, 0x0, 0x0) = 0 0
@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,
@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 / 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