Skip to content

Instantly share code, notes, and snippets.

View ncwhale's full-sized avatar
🎯
Focusing on Game!

Whale Mo ncwhale

🎯
Focusing on Game!
  • Tokyo, Japan
  • 16:44 (UTC +09:00)
View GitHub Profile
@ncwhale
ncwhale / gist:3a759baf227e72bd0dcd
Created May 31, 2014 17:16
quietlynn / js01.md 芙兰的答案
#作业1
(C)->"#{C} 摄氏度等于 #{C*1.8+32} 华氏度。"
(F)->"#{F} 华氏度等于 #{(F-32)/1.8} 摄氏度。"
#作业2
[ B, A ] = [ A, B ]
#作业3
SEC_IN_YEAR = 60*60*24*365 + 60*60*6 + 60*9 + 10
SUPERMAN_CODELINE_IN_YEAR = SEC_IN_YEAR / 17 #SuperMan without rest
@ncwhale
ncwhale / 20160517075514-init.js
Created May 26, 2016 03:23
不小心删除了整个库的 migration喵……
'use strict';
module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.sequelize.query('CREATE EXTENSION IF NOT EXISTS pgcrypto;');
},
down: function (queryInterface, Sequelize) {
// 这是大地终焉之处
// return queryInterface.dropAllTables()
@ncwhale
ncwhale / fs.js
Created September 14, 2016 03:36
Promise 玩递归喵~
'use strict';
/**
* Promised fs - fs.js
* Copyright(c) 2016
* MIT Licensed
*
* @author Whale Mo (@whalemo)
*/
const fs = require('fs');
const Path = require('path');
@ncwhale
ncwhale / av6508551.js
Last active October 5, 2016 10:43
#53 周刊弹幕,已手工修订喵
if(!$G._get("exists")) {
$G._set('exists', true);
var buttonInfos = {
'B_30':{startTime:120.77,avNum:'av6025863',text:'【东方原创编曲】幽雅的盛开,墨染的樱花 ~ Ordinary Remix',delay:8,x:5.5,y:224.5,width:497.5,height:60},
'B_29':{startTime:128.85,avNum:'av6411176',text:'【东方MMD】咲夜的命运之夜・序章',delay:12,x:5.5,y:224.5,width:497.5,height:60},
'B_28':{startTime:148.93,avNum:'av6392037',text:'【东方手书】若鹭姬的鱼卵三明治',delay:11,x:5.5,y:224.5,width:497.5,height:60},
'B_27':{startTime:168.97,avNum:'av6326230',text:'【东方/幻想万华镜】花朵艳丽 终会散落',delay:11,x:5.5,y:224.5,width:497.5,height:60},
'B_26':{startTime:189.06,avNum:'av6452468',text:'【東方MMD】和服版霊夢酱的極楽浄土【唯美向】',delay:11,x:5.5,y:224.5,width:497.5,height:60},
'B_25':{startTime:209.1,avNum:'av3388284',text:'【囧星人】猴子也能懂的东方Project (修正版) #0~#6 未完',delay:7,x:5.5,y:224.5,width:497.5,height:60},
Name:
"<style>
#scheme-Paradox .material-layout .mdl-card {
background-color: #111;
}
</style>"
bool ledBinkStatus = false;
//SoftwareSerial inSerial(0, 1); // RX, TX
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
// Keep SDA/D2 OUTPUT to LOW
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
// start serial port (On USB)
@ncwhale
ncwhale / main.cpp
Last active March 6, 2019 10:58
When to use virtual destructor.
#include <iostream>
#include <sstream>
#include <memory>
class A {
public:
A() {
std::ostringstream oss;
oss << "Constructor A@" << std::hex << (void *)this << "\n";
std::cout << oss.str() << std::flush;
# This function will automate grep CMD($1) windows and set OPACITY($2).
transparent_windows() {
for i in $(pgrep -f $1); do
for j in $(/usr/bin/xdotool search --pid $i); do
xprop -id $j -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(printf 0x%x $((0xffffffff * $2 / 100)));
done
done
}
# Give vscode an alias.
#!/bin/bash
MAC="1234567890AB"
COOKIE_FILE="/tmp/router_cookie.txt"
function fetch_result() {
local R=$(curl -s -b "$COOKIE_FILE" 'http://192.168.1.1/cgi-bin/luci/admin/device/devInfo?type=0&_=0.'"$(date +\"%s\")" | jq '.count = {}| .curip = {} | .[] | select(.mac)')
date
echo "$R" | jq --raw-output '"\(.mac)\t\(.ip)\t\(.restrict)\t\(.upSpeed)\t\(.downSpeed)"'
@ncwhale
ncwhale / Desktop Play.sh
Last active June 4, 2020 17:53
Play any video on your Cinnamon( nemo-desktop ) Desktop using mpv.
#!/bin/bash
DESKTOP_WID=$(xdotool search --onlyvisible --classname "nemo-desktop" | head -n 1)
mpv --no-border --no-audio --osc=no --title="Desktop" --loop-playlist --wid="$DESKTOP_WID" "$@"