Skip to main content

code

2016


so here is vyw

·2 mins
I supposed to write this weeks ago though, anyway. Here is vyw, it’s a client side file browser. Vyw actually is a continuation of this post. At least the idea was already popped up around that time, but I only had the chance to tinker around it few weeks ago. So the idea was to have this fully functional file browser, or specifically, images browser with thumbnail view, which usually achieved with server-side app, backed only with nginx.

2015


Things I did randomly last week

·6 mins
I actually have like 3 post drafts queued before this, 2 reviews for the Hibike! Euphonium ending, and a note on how I rewrote shreds with ES2015, ractiveJS, and a bastardized Flux architecture. But anyway, I kind of in the mood for writing about things I did last week. So it just came to me that it’s probably about time to rotate my SSH keys, random public keys started to piled up at my GitHub and Bitbucket account and I decided to remove them all and start with the new one.

git unhg

·2 mins
I should tidy up my $HOME/bin directory, some of actually useful scripts and configurations were scattered here and there. Anyway, I’ve been using this one script when I work with shreds: #! /usr/bin/env bash interim_branch=default rollgit() { [[ $# -ne 1 ]] && { echo 'wrong number of arguments, USAGE:' printf "\tgit roll <branch>\n" exit 1 } git rebase $1 && git checkout $1 && git rebase $interim_branch && git branch -D $interim_branch } unhg() { [[ $# -ne 2 ]] && { echo 'wrong number of arguments, USAGE:' printf "\tgit unhg <remote> <branch>\n" exit 1 } git-hg fetch $1 && git checkout -b $interim_branch FETCH_HEAD && git roll $2 } self=$(basename $0) case $self in git-unhg) unhg $* ;; git-roll) rollgit $* ;; *) echo 'Invalid command specified' ;; esac Shreds source revisions is actually tracked on mercurial.

2013


Code Tidbits: wrk pt.1

·9 mins

I have this plan to do some write up series related to programming and such, mostly as another form of practicing C systems programming. Just when I wondered about what topic I should write, I found this gem written by Will Glozer. So I think I can study the source code and write some little explanation here and there about the code, hence the tidbits. Feel free to critic and correct things if you find mistakes on this. It would be my honour.

I kinda like the source code for its simplicity and learn a lot from them. The library used from redis including zmalloc and ae. I will going into zmalloc, before that, lets see this aprintf first.

The Hook

·1 min
Referring to previous post, this is the post-receive script I used for the blog. Actually I forgot to attach this to the previous post, so I decide to just create another post for this. {% include_code post-receive lang:sh post-receive %} The locale entries is needed by jekyll, since it’s not set at git/www user environment Also don’t forget to add this entry to sudoers git ALL=(www) NOPASSWD: ALL Basically, it tells sudo to allow git to act as www without any password.

2012


imgpop

·2 mins

Now I will going into technical details inside imgpop.

Like I said in the previous post. I extends Brian’s imgpopup and do some makeup to things. At the backend, I use mini_magick to actually save the resized image, and use that as preview/thumbnail. Here’s the snippet.

#...#
# Open the source image, and scale it accordingly.
image = MiniMagick::Image.open(image_path)
vars['full_width'] = image[:width]
vars['full_height'] = image[:height]
image.resize "#{@percent}%"

rpath = source+ resized_image
if not File.exists? rpath
# Actually save the image
  image.format "jpg"
  image.quality "92"
  image.write rpath

  # This is the tricky part
  # we should register the new created file
  # since Jekyll already indexed all files before
  context.registers[:site].static_files << StaticFile.new(
          context.registers[:site], source, File.dirname(@path.sub(%r{^/}, '')),
          "resized_#{File.basename(@path)}")
  print "image saved to #{rpath}\n"
end
#...#

Image viewer is up!

·1 min
Yay, it’s up. You can click images above to try it out. a pop-up will appear with full sized image, and it’s draggable! You can also try hover the upper area of the popup to see the tagline/title and download link for the image. Credits to Brian Clapper. He made the base implementation for this with jQuery and jQueryUI. From there, I extend some stuff to make it more organic.

2009


securing html form

·2 mins
Why we have to make sure our html form is secure?? ‘cuz we don’t want someone doing something silly to our website, avoiding cross site scripting and negate injection or hijacking… well, I guess there’s a lot of method to prevent those things… mm, and I found mine… dunno if someone already come up with the same method… I don’t do any research on this… so I won’t claim anything about the method… and I hope no one do something retard like claiming this method as their… Oh, and I think this method is old… not too smart… and might be easy to get hacked… So, the problem is : 1.

2008


fair good music player...

·2 mins
since I decide to use fully gtk based application on my Gnome Desktop, I’ve got some media players installed… let says… Banshee, Audacious, BMPx, Exaile, RhythmBox, Totem, Quark, Aqualung, Bluemindo,… etc,etc… umm.. yes it kind a useless to install all of them, when you will use only one player instead… so, I do some benchmarking to all of them… first is… usability, then simplicity, the last is feature… great music player must implement this quote… ‘it just works…’ yes.

more or less into the moon

·1 min
nothing…. it’s just an ordinary day… okay this is for today : Lua lua is scripting language and widely used as an embedded language for the other more complex program. some of plugin in Adobe PhotoShop made using lua, some rts game generate map and other stuff from lua script, and if you work for fansub team as a karaoke styler.. it’s a common sense to use lua script for karaoke automation… lua name taken from portugese, which is meaning ‘moon’.