Skip to content

Instantly share code, notes, and snippets.

@iveskins
iveskins / eng.question.maker.nounquiz.v3.ruby
Last active June 5, 2016 13:58
Ruby regex for cleaning up text parsed into parts of speect at http://nlp.stanford.edu:8080/parser/index.jsp Stanford Parser .. and then out put as a quiz for choosing the right article
#!/usr/bin/ruby
require 'cgi'
require 'uri'
require 'net/http'
input = File.read("./query.txt")
#inputhtml = CGI::escapeHTML(input)
#puts inputhtml
#lookup = %Q^&query=Kittens+are+sometimes+born+with+defects.+People+who+receive+cats+as+gifts+are+recommended+to+get+it+examined+for+its+health.+Some+birth+defects%2C+like+heart+problems%2C+require+urgent+vet+attention.+Others+are+harmless%2C+like+polydactyly.+Polydactyly+means+many+digits%2C+or+many+%22fingers%22+from+poly+%28many%29+and+dactyl+%28digit%29.+Sometimes%2C+there+is+a+mutation+%28change%29+in+cat+families.+Most+cats+have+only+four+to+five+toes+per+paw%2C+depending+on+whether+it+is+the+front+or+back+paw.+These+mutated+cats+have+six%2C+seven%2C+and+in+rare+cases+even+more.+All+of+these+cats+are+called+polydactyl+cats.+They+can+also+be+called+Hemingway+cats+because+author+Ernest+Hemingway+owned+many+of+these+cats.&parserSelect=English&parse=Parse^
lookup = %Q^&query=^+input+%Q^&parserSelect=English&parse=Parse^
@iveskins
iveskins / gist:8d4614bdb153b11e4e1ad7aec86283f1
Created June 18, 2016 05:55
bunsetsu phrase level translations and hiragana reading to japanese text
step 1 go to
http://furigana.sourceforge.net/cgi-bin/index.cgi
put in the japanese you want to read
step 2
copy the source code of the response to a file
step 3
snip out bits you dont need
step 4 sorry about the cat
cat furigana.large.html | sed 's/<ruby>/\n&/g'| sed 's/<rp>[()]<\/rp>//g' | awk -F'[\<\>]' '{cmd = "/usr/local/bin/trans -brief " $5$13"";cmd |getline out; print "<ruby><ruby><rb>"$5"</rb><rt>"$9"</rt></ruby>"$13"<rt>"out"</rt></ruby>"$14$15$16$17$18$19$20; close(cmd)}' > some file .html
step 5
#! /bin/bash
# function to create all dirs til file can be made
function mkdirs {
file="$1"
dir="/"
# convert to full path
if [ "${file##/*}" ]; then
file="${PWD}/${file}"
@iveskins
iveskins / app.js
Created March 31, 2017 16:43
playing with angular-chart.js and ngResource
var app = angular.module('flapperNews', ['ui.router','chart.js','ngResource'])
app.config([
'$stateProvider',
'$urlRouterProvider',
function($stateProvider,$urlRouterProvider){
$stateProvider
.state('home',{
url: '/home',
templateUrl: '/home.html',
@iveskins
iveskins / katakana2english.regex.rb
Created April 21, 2017 17:36
trying to change katakana to be read with more natural pronunciation. but .. probably better to go from english to ipa to this half katakana mix .. coming back from katakana you cant tell the v from the b ect
file = File.open("klist.txt")
conts = file.read
#Fs
re = /(フェ)|(ファ)|(フォ)|(フー)|(フィ)/
subst = {'フェ' => 'fェ', 'ファ'=> 'fァ', 'フォ' => 'fォ', 'フー' => 'fー', 'フィ' => 'fィ'}
result = conts.gsub(re, subst)
@iveskins
iveskins / .screenrc
Last active September 3, 2017 08:52 — forked from joaopizani/.screenrc
A killer GNU Screen Config
# the following two lines give a two-line status, with the current window highlighted
hardstatus alwayslastline
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
# huge scrollback buffer
defscrollback 5000
# no welcome message
startup_message off
@iveskins
iveskins / target.stream.twitch.sh
Created September 7, 2017 16:29
stream to twitch from ffmpeg needs xwininfo. click on window after running
#! /bin/bash
# streaming on Ubuntu via ffmpeg.
# see http://ubuntuguide.org/wiki/Screencasts for full documentation
# see http://www.thegameengine.org/miscellaneous/streaming-twitch-tv-ubuntu/
# for instructions on how to use this gist
if [ ! -f ~/.twitch_key ]; then
echo "Error: Could not find file: ~/.twitch_key"
echo "Please create this file and copy past your stream key into it. Open this script for more details."
@iveskins
iveskins / index.html
Last active September 21, 2017 02:22 — forked from bunkat/index.html
Round date scale
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.axis text {
font: 10px sans-serif;
}
.axis path, .axis line {
fill: none;
@iveskins
iveskins / 00_README.md
Created February 1, 2018 10:19 — forked from emk/00_README.md
Anki subs2srs card template, with optional hint and note

To use these templates, you'll need to create a new Anki "note type" with the following fields:

  • Sound
  • Time
  • Source
  • Image
  • Target: line
  • Base: line
  • Target: line before
  • Base: line before
@iveskins
iveskins / iterm2.md
Created August 24, 2018 08:51 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Fullscreen + Enter
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow