Skip to content

Instantly share code, notes, and snippets.

View ophentis's full-sized avatar

Willy Tseng ophentis

View GitHub Profile
@ophentis
ophentis / cookie_package.json
Last active November 5, 2019 10:40
for cookie.js insomnia plugin
### Keybase proof
I hereby claim:
* I am ophentis on github.
* I am wtseng (https://keybase.io/wtseng) on keybase.
* I have a public key ASCqatnw-utxaHGx1PCB4LPw4EG7oNiyIF9OkzlkVJhtugo
To claim this, I am signing this object:
@ophentis
ophentis / scriptdump.rb
Created November 15, 2017 22:25
MuranoCLI plugin to dump out concatenated scripts.
# Save a file in ~/.murano/plugins/scriptdump.rb
#
command '_s dump' do |c|
c.syntax = %{mr _s dump}
c.summary = %{dump combined script}
c.description = %{dump combined script}
c.action do |args, options|
sid = $cfg['application.id']
@ophentis
ophentis / dbclean.sql
Created April 9, 2017 17:20
postgresql drop table generator
select 'drop table if exists "' || tablename || '" cascade;'
from pg_tables
where schemaname = 'public'; -- or any other schema
-- Import packages
require 'torch'
require 'gnuplot'
--------------------------------------
-- Define the Kalman filter 'class' --
--------------------------------------
-- Constructor
Kalman = {}
Kalman.__index = Kalman
@ophentis
ophentis / character.json
Created April 12, 2016 14:38
Merc characters
[{"no":"5101","id":"152","title":"[灼熱の剣豪]","name":"モルーシャ","rarity":"5","element":"火","birth":"砂漠の国","gendar":"男","age":"16","weapon":"打撃","growth":"晩成","targets":"1","hp":"3680","attack":"3600","speed":"57","rate":"2.4","distance":"30","kbdr":"0.41","kblx":"8","endurance":"71","r_fire":"94.078","r_water":"1","r_wind":"0.67","r_light":"1.5","r_dark":"1","undefined":"71.69"},{"no":" 5102","id":"156","title":"[砲台上の酒豪]","name":"ヴィルベル","rarity":"5","element":"火","birth":"常夏の国","gendar":"女","age":"23","weapon":"銃弾","growth":"晩成","targets":"5","hp":"2600","attack":"3100","speed":"40","rate":"3.5","distance":"200","kbdr":"0.14","kblx":"35","endurance":"17","r_fire":"30.693","r_water":"1","r_wind":"0.91","r_light":"1.1","r_dark":"1","undefined":"7.63"},{"no":" 5103","id":"296","title":"[無秩序な真紅]","name":"シエラ","rarity":"5","element":"火","birth":"魔法の国","gendar":"女","age":"27","weapon":"魔法","growth":"晩成","targets":"4","hp":"2260","attack":"3400","speed":"60","rate":"3.45","distance":"190","kbdr":"0.25","kblx":"22","endura
!function go() {
return $('#grid div')
.get()
.map(function(div) { return {v:div.innerText|0,div:div} })
.filter(function(box) { return box.v })
.sort(function(a,b) { return a.v - b.v })
.reduce(function(p,box) {
return p.then(function() {
return new Promise(function(resolve, reject) {
$(box.div).trigger('tap')
@ophentis
ophentis / gist:f7bc62c98c82b502788b
Created December 29, 2014 06:17
download file from data uri in browsers
function saveTextAsFile(content,filename) {
downloadURI('data:application/javascript;charset=UTF-8,' + encodeURIComponent(content), filename);
}
function downloadURI(uri, name) {
var link = document.createElement('a')
link.download = name
link.href = uri
$(link).appendTo('body') //document.body.appendChild(link)
link.click()
@ophentis
ophentis / gist:db691586d0b9b3afba2d
Created December 24, 2014 02:42
onep lua - looping through datasource
local devices = alias['devices_cp']
-- reset last pointer
devices.last = 0
local value = true
local count = 0
local ts = now
while count < 1000 and value do
@ophentis
ophentis / gist:e6154aab2ecfaab3f813
Created October 30, 2014 12:31
recursive fabnacci with tail recurrsion
function fab(k) {
var m = arguments[1] = arguments[1] || 1,
n = arguments[2] = arguments[2] || 1
return k<=2 ? arguments[k] : f(k-1,n,m+n)
}