Skip to content

Instantly share code, notes, and snippets.

View walfie's full-sized avatar

walfie

  • New York City
  • 00:34 (UTC -04:00)
View GitHub Profile
@walfie
walfie / line.md
Last active August 29, 2015 14:21
some nice line stickers
@walfie
walfie / xfce_tumblr_wall.rb
Created August 26, 2015 01:45
Get random tumblr post, set it as wallpaper
# This is pretty bad code. Don't use it expecting it to work well
require 'net/http'
require 'uri'
require 'nokogiri'
# copied and pasted from:
# http://ruby-doc.org/stdlib-2.2.3/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-Following+Redirection
def fetch(uri_str, limit = 2)
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
@walfie
walfie / passion.sh
Created September 20, 2015 00:01
originally used to find passion flower on clubdam's website
#!/usr/bin/env bash
title='恋するみたいなキャラメリゼ'
curl -s 'http://www.clubdam.com/app/search/searchKeywordKaraoke.html' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data "keyword=$title&searchType=1&matchOption=0&x=0&y=0" \
--compressed \
| grep -i $title \
| perl -pe 's/<.*?>/ /g'
@walfie
walfie / Gemfile
Last active November 22, 2015 19:27
Get tweets, followers, following
source 'https://rubygems.org'
gem 'twitter'
gem 'dotenv'
@walfie
walfie / idol.scala
Last active February 1, 2016 05:00
Find possible subunits of size <= 8
sealed abstract class Idol(val id: String)
case class Subunit(name: String, members: Set[Idol])
object Subunit {
def apply(name: String, members: Idol*): Subunit = apply(name, members.toSet)
}
case class IdolUnit(members: Set[Idol], subunits: Seq[Subunit])
Available idols:
=========
11
Juri, Otome, Akari, Sumire, Ichigo, Hinaki, Madoka, Rin
(Vampire Mystery, Luminas, Vanilla Chili Pepper, DansingDiva, Jonetsu Jalapeño, Skips♪, Oshare Kaito Swallowtailshin, Aikatsu! Sensei, Tsunagaru Baton, Oto
me to Hinaki no Mattari Saka, Gogo wa Ichi Ichi Ichigo Kibun)
=========
10
Juri, Sakura, Otome, Akari, Sumire, Shion, Ichigo, Hinaki
(Vampire Mystery, Powax2PuRiRiN, Luminas, Jonetsu Jalapeño, Oshare Kaito Swallowtailshin, Fushigi no Kuni no Alice, Aikatsu! Sensei, Tsunagaru Baton, Otome

Keybase proof

I hereby claim:

  • I am walfie on github.
  • I am walfie (https://keybase.io/walfie) on keybase.
  • I have a public key whose fingerprint is 5601 632B 2B37 CE71 C060 BEA0 5B97 3FD2 6105 0838

To claim this, I am signing this object:

@walfie
walfie / README.md
Last active October 18, 2016 02:50
Bookmarklet to translate Granblue boss
  1. Create a bookmark with the following "URL" (bookmarklet):

    javascript:!function(){var a=[].slice.call(document.querySelectorAll('.enemy-info>.name')).map(function(a){return a.innerHTML}).filter(function(a){return a.length>0});jQuery.ajax({dataType:'json',url:'http://gbf-raidfinder.aikats.us/api/bosses.json',data:{name:a},traditional:!0,success:function(a){var b=a.raidBosses.map(function(a){return(a.translatedName||{}).value}).filter(function(a){return a});document.querySelector('#frm-post-tweet').value=b.join(' ')}})}();

  2. Go to a raid and open the "Post to Twitter" menu (via "Request Backup" -> "Tweet")

  3. Click the bookmarklet

  4. If a translation is found, it will be inserted into the input box

Note: Translations might not be found for new event bosses that don't have images yet.

Here's a demo video.

@walfie
walfie / local-webworker.html
Last active April 10, 2024 12:52
Run webworker from `file://`, with working `importScripts`
<script>
function createWebWorkerFromFunction(f) {
var blobContents = ['(', f.toString(), ')();'];
var blob = new Blob(blobContents, { type: 'application/javascript'});
var blobUrl = URL.createObjectURL(blob);
var worker = new Worker(blobUrl);
URL.revokeObjectURL(blobUrl);
@walfie
walfie / -twitter-archive-search-webworker.md
Last active November 6, 2016 22:39
Search twitter archive in a web worker

Twitter Archive Search in Web Worker

Twitter's default offline archive search is slow as heck. If you do it in a web worker, the search itself is actually pretty fast.

Instructions

  • Download search.html and worker.js to the root directory of your twitter archive (the same directory as index.html)
  • Open search.html in browser
  • Open JS console (probably ctrl shift j)
  • Type search("insert some regex here") and press enter