HNHacker News
TopNewBestAskShowJobs

codesink

233 karma · joined August 27, 2008

coding for fun and profit http://codesink.org
submissionscomments
codesink··on Show HN: I built a climbing tracker for data-obsessed climbers (Expo/RN)
Thanks! I might have posted it too early in the day, I'll try again :-)
codesink··on Move all photos from Google takeout into one directory
I can't believe this is getting upvotes on HN, this is buggy and a simple oneliner can do it.
codesink··on Ask HN: Who is hiring? (February 2019)
Parkopedia | Full-time in London, UK | ONSITE

Parkopedia was founded with the mission of being able to answer any parking question, anywhere in the world. Today, Parkopedia is the world’s leading digital parking services provider used by millions of drivers and organisations such as Apple, TomTom and 18 automotive brands ranging from Audi to Volvo.

We are looking for a Senior PHP/Full-stack Developer to be based in London to support our existing systems as well as to architect and to develop new solutions that run on top of our global AWS based infrastructure (APIs, public/customer facing web applications, payments transaction platform, etc).

Our benefits include unlimited vacation policy / flexible working hours / cash bonus / annual company trip / time off for volunteering

Please visit https://www.workable.com/j/257C9360D7 to apply.

codesink··on Introducing Backup and Sync for Google Photos and Google Drive
Still, no linux client.
codesink··on Ask HN: How do you store and organize your startup ideas?
~/Dropbox/ideas.txt adding new entries at the top of the file. I wonder how many thousand ideas.txt files are on Dropbox servers :)
codesink··on Ask HN: Nepal's ccTLD registrar won't let devs update nameservers. What to do?
Those are charges of eurodns; I called them and they said that they're just passing on me what the registrar charge them.
codesink··on Ask HN: Nepal's ccTLD registrar won't let devs update nameservers. What to do?
That sucks.

What also sucks is being asked for money to change name servers only:

  .gr: £46.64 (74 USD)
  .cz: £14.57
  .dk: £24.29
  .hu: £17.49
  .ro: £17.49
codesink··on Sell HN: Do you have a side project you want to sell?
I spent quite a bit of time on AppLens, an icon matching app for iOS (take a photo of an icon --> download the app).

The backend (in C) is pretty fast and stable (current uptime 384 days) and it can be used for other types of images (i.e. not icons but photos, covers, etc.).

App Store link: http://bit.ly/Szmy7X

codesink··on A faster way to delete millions of files in a directory
I stumbled over it few months ago and the issue was that readdir(), used by rm on the box I was using, by default alloc'd a small buffer (the usual 4KB) and with millions of files that turned in millions of syscalls (that's just to find out the files to delete).

A small program using getdents() with a large buffer (5MB or so) speeds it up a lot.

If you want to be kind to your hard drive then sorting the buffer by inode before running unlink()s will be better to access the disk semi-sequentially (less head jumps).

codesink··on Share your weekend/part-time startup (December 2012)
Thanks!! :)
codesink··on Share your weekend/part-time startup (December 2012)
I made AppLens (formely AppSnap) a iphone app that lets you install any other iphone app by taking a picture of its icon (on other phones or laptop screens or anything else).

It's a free app + ads, most of its users are from china and japan.

Money-wise definitely not an hit!

I spent quite a bit on time to develop the backend part (in C) and optimized it to query 3mil icons in few ms on a commodity server (cheap).

http://bit.ly/Szmy7X

codesink··on Ryanair now presents you with a Recaptcha every time you search for a flight
They don't like scrapers, they don't even allow links to their website without permission.

From their TOS:

"5. Links to this website. You may not establish and/or operate links to this website without the prior written consent of Ryanair."

codesink··on How I Made $19,000 on the App Store While Learning to Code
A good designer can score on the Appstore even if he is a novice programmer.

Unfortunately that's not true for good programmers that suck at design.

codesink··on C'mon, stop writing Java for Android
They managed to optimize their golang.org homepage to get the position #5 on the word "go".

They must be good at SEO.

BTW the video I mentioned is at http://www.youtube.com/watch?v=-i0hat7pdpk&feature=playe...

(at the end during Q&A)

codesink··on C'mon, stop writing Java for Android
I think google is working to move Android to Go as soon as possible; Rob Pike replied to a related question with "I cannot talk about it" and that sounds like a good clue :)

Go binaries already run on Android/ARM, the higher level code is the one that's missing.

That would bring great boost in performance (compilers are available for both x86 and ARM) without adding any complexity on the language side (Go is a cool language).

codesink··on Intuitive explication of Fourier Transformation
A great resource to read about Fourier transformation and Wavelets

http://users.rowan.edu/~polikar/WAVELETS/WTpart1.html

codesink··on Google App Engine 1.5.0 released
Backends seem overpriced to me; their default backend is a long-lasting process running at 1.2Ghz allowed to use 256MB of RAM and it's priced $0.16/hour ($115/month).

They can shutdown/restart/relocate your backend whenever they want so what they suggest to keep your service live is "Configuring more backend instances than are normally required to handle your traffic patterns" (yeah that's at least another $115/month fee).

codesink··on Show HN: Tasskr
I've used 37signals tada lists in the last few months and the main pain points are:

1) no indenting 2) cumbersome reordering 3) editing sucks

your tasskr fixes all the above issue, well done.

for me what is missing to make the switch is sharing (anybody in the team is allowed to add or check an item).

if tada list is one of your main competitor I'd add an import page to make the switch easy (I'd prefer pasting the HTML in a textarea instead of give you my credentials).

codesink··on Which programming book you just couldn’t stop reading from start to end?
I loved Stevens' books:

TCP/IP illustrated Unix network programming Advanced Programming in the unix environment

codesink··on The Only OS X Shortcut You Need to Remember
Brilliant, with Chrome and Safari you can use it to search and open any bookmarked page.
codesink··on Calculate Latitude/Longitude Distances in MySQL with the Haversine Function
geospatial index do NOT work if you're using InnoDB; so you must choose between geospatial queries or transactions (that MyISAM don't support).
codesink··on Calculate Latitude/Longitude Distances in MySQL with the Haversine Function
true, the distance calculation must NOT be in the WHERE clause if you want to use indexes (and you want).

What I'm doing, given a max distance and a search point, is to calculate the bounding box in which I want to search in filter results with

WHERE lat BETWEEN lat_min AND lat_max AND lng BETWEEN lng_min AND lng_max

Calculating latitude min/max is trivial knowing that 1 latitude degree is 111.2KM. Longitude is a bit more convoluted because longitude degree size changes moving north/south.

$lat_min = $lat - $range_km * (1 / 111.2); $lat_max = $lat + $range_km * (1 / 111.2);

$k = $range_km/6371.04; $lng_min = $lng - rad2deg($k/cos(deg2rad($lat))); $lng_max = $lng + rad2deg($k/cos(deg2rad($lat)));

codesink··on Moving from PHP to C saved my web startup.
you can embed your own C code without the hassle to handle HTTP/S (or forkbombs) using KLone web server; it can easily handle thousands of requests per second.

p.s. I'm part of the company whom made it.

codesink··on Ask HN: Managing my own server.
I'm pretty happy with VMware Fusion.

http://www.vmware.com/products/fusion/

codesink··on Poll: What web server do you use?
appsnap backend: nginx -> klone -> image matching server
codesink··on Fast and slow if-statements: branch prediction in modern processors
The Linux kernel exploits that by using two macros (likely() and unlikely()) that give hints to the compiler using GCC's __builtin_expect:

if(likely(condition)) dosomething();

codesink··on How Google Maps splits the world in 2^20 256x256 tiles (2006)
EDIT: "Each tile is 256 pixels square and the number of tiles across at each zoom level is given by this formula: Math.pow(2, zoom)"; ops I missed the word "across" :)

How did you come up with that number? The sum loop that follows reports 524287 tiles total.

#include <stdio.h> #include <math.h> int main(void) { int i; double tot = 0; for(i = 0; i <= 18; ++i) tot += exp2(i); printf("tot %f\n", tot); return 0; }

codesink··on How Google Maps splits the world in 2^20 256x256 tiles (2006)
You can read why that happens in the paragraph titled "Scale".

Here's an excerpt (given that Google tiles are 256x256 and at zoom 0 one tile covers the whole world):

"Intuitively its easy to see why the scale changes. Let's think about Google Maps zoom level 0. At zoom level 0 the world is fit into a 256 pixel wide image. But we know that the earth's circumference is the largest at the equator and dwindles down to zero at the poles. So as you move north or south away from the equator, the Earth has to be "stretched" to fit into the 256 wide bitmap. Thus as you move north or south the scale gets larger and larger because the same number of pixels on the screen are showing you a larger and larger percentage of the Earth's surface."

codesink··on How Google Maps splits the world in 2^20 256x256 tiles (2006)
Please note that the article is four years old and, as far as I can tell, Maps API has been launched mostly in the same period (wikipedia:Google_Maps).

I don't know how much information was available at that time but it shouldn't be much.

codesink··on My Common Git Workflow
There's a free book about git available at

http://progit.org/book/

Both the basics and advanced topics are clearly discussed.

Page 1 of 2Next →