Using the Xbox One Controller with The Talos Principle

It took a bit of tinkering, but thanks to this reddit I figured it out.

While this was only tested with The Talos Principle, it should work with any game that uses SDL to handle controllers.

1. Download the latest gamecontrollerdb.txt from gabomdq/SDL_GameControllerDB.

2. Add the contents of the file to an environment variable called SDL_GAMECONTROLLERCONFIG.

3. Relog and profit.

References:


HOWTO: Cross-compile a Go app for Windows from Linux

I recently needed to test some app on windows, and while cross-compiling in Go is straight-forward, the app had some C code and apparently on Arch Linux the mingw64-gcc package is misconfigured.

After some head scratching I figured out a workaround until the package is fixed (task #4313), you have to link your Go code against ssp.

note this bug is specific to Arch Linux, however other distros might build the toolchain in the same manner.

Building the toolchain:

1. Download and unpack the Go source code:

note this guide assumes $GOROOT is set to /usr/src/go/.

  • Use mercurial (slow) hg clone -u release https://code.google.com/p/go
  • Use the source tarball from golang.org

1a. (optional but recommended) add export PATH="$PATH:$GOROOT/bin" to your ~/.bashrc (or the equivalent file for your shell).

2. Compiling the native toolchain:

3. Compiling the Windows toolchain without CGO:

Repeat with GOARCH=amd64 if you want to build win64 binaries.

4. Compiling the Windows toolchain with CGO support:

  • Install mingw-w64-gcc

Repeat with GOARCH=amd64 CC_FOR_TARGET="x86_64-w64-mingw32-gcc .... if you want to build win64 binaries.

note that once the bug is fixed, you can remove -fno-stack-protector -D_FORTIFY_SOURCE=0 -lssp from CC_FOR_TARGET.

Actually compiling your code to run on windows:

We use the same environment variables from earlier, except we have to replace CC_FOR_TARGET with CC

Code:

Testing:

note that to build native go with cgo you will have to use env CC=gcc go build


Poor man’s multi cursor in VIM

I tried vim-multiple-cursors but it was just doing weird things and not replacing the right words, so after digging around for a while I came up with this:

Simply add it to ~/.vimrc.

Basically it's the same as using alt+f3 in Sublime Text.


Sourcing different environment files in Fish Shell

I've recently started using Fish Shell and I really like it since I spend most of my time using the shell, Fish's IntelliSense-like completion is handy.

One thing that bugged me is the lack of being able to easily separate environment variables into separate files so I added this little block inside my fish_prompt function in /etc/fish/functions/fish_prompt.fish :
Continue reading


Generating new bson.ObjectId with a Specific timestamp.

For a project I'm working on, using the excellent mgo driver, I needed to be able to query the MongoDB collection by the ObjectId's timestamp.

And while I was inserting dummy data, I had no obvious way to generate a new unique ObjectId with a timestamp (the timestamp itself wasn't unique) so I wrote this little helper function.

Note that this function isn't the same as bson.NewObjectIdWithTime, bson.NewObjectIdWithTime works for generating a timestamp-only ObjectId that you can query the database with, but not for insertion.
Continue reading


Guild Wars 2 Event And Boss Timers.

Where to find

You can find the clean timer at gw2.limitlessfx.com (HTTPS Version)

Project Goals

We could not find a working timer for the new Event/Boss schedule after the April 2014 Feature Pack. So we ended up creating our own and publishing it at gw2.limitlessfx.com. Feel free to use it / link to it.

The goal was to create and maintain a Guild Wars 2 world event timer that was simplistic in design. Specifically a timer that didn't have all the clutter of ads, menus, or unnecessary images wasting much of the screen. OneOfOne later adjusted the timer so it scales down and still looks good on incredibly small screens. Maintaining mobile compatibility has remained a priority since then.

Change Log

  • 2020-09-15 DragonHunter: Updated for Sunqua Peak Fractal
  • 2019-02-17 DragonHunter: Updated for Siren's Reef Fractal
  • 2018-06-26 DragonHunter: Daily section supports Deepstone Fractal and new level numbering.
  • 2017-11-28 DragonHunter: Daily section supports Twilight Oasis Fractal and new level numbering.
  • 2017-07-26 DragonHunter: Daily section supports Shattered Observatory Fractal and level numbering.
  • 2017-06-19 DragonHunter: Added "Today" and "Tomorrow" buttons for daily achievements.
  • 2017-06-12 DragonHunter: Put the Fractal levels back into daily Tier listing.
  • 2017-02-26 DragonHunter: Guild Wars 2 updated their API to show what dailies are "HeartOfThorns" only. They also added Fractals to their Daily API (previously the Fractal info was completely separate). Updated the daily section of the timers to take advantage of these changes. Also changed the fractal system so it should keep itself up-to-date if they add additional fractals or fractal daily numbers (as long as the API doesn't change)
  • 2016-11-22 DragonHunter: Updated Daily Fractals for the new Nightmare fractal and the new Tier 3 "Daily Recommended Fractal" (although most don't show up in the API yet so they won't be named).
  • 2016-07-28 DragonHunter: Updated the Fractal numbers to support the new Chaos Isles addition.
  • 2016-04-26 OneOfOne: Added Let's Encrypt SSL Certificate to the gw2 subdomain.
  • 2016-04-25 DragonHunter: Updated to hide non-HOT dailies.
  • 2016-04-21 DragonHunter: Made changes to support/consolidate the "Daily Tier" fractals.
  • 2016-03-17 DragonHunter: Added optional browser API Notifications. Added optional tabbed list of dailies.
  • 2016-01-10 DragonHunter: Daily Fractal (Level, Fractal, and any bonus daily) is shown at the top of the page.
  • 2015-12-06 DragonHunter: Using the official achievement API to call the PvE daily boss. Thanks for previously voting.
  • 2015-10-22 DragonHunter: Added "Unknown" PvE boss incase new dailies are added with Heart of Thorns.
  • 2015-07-27 DragonHunter: Users can now vote on which is the Daily PvE Boss since no daily rotation seems forthcoming.
  • 2015-05-19 DragonHunter: Removed auto PvE Daily Boss. Will be manually set until new rotation is found.
  • 2015-03-12 DragonHunter: Fixed Shatterer daily
  • 2015-03-11 OneOfOne: Redid the layout to be mobile friendly again
  • 2015-03-05 DragonHunter: Added dark colored template
  • 2015-03-02 DragonHunter: Added PvE daily, epic boss icons, moved "hide" button
  • Bunch of minor changes here I didn't log and don't remember
  • 2014-04-17 OneOfOne: Published the first version of the timer

Suggestions

You are free to offer suggestions for features you'd like to see added. You may also offer suggestions for other Guild Wars 2 projects you'd like to see created. Do keeping in mind that any suggestions should remain within the Project Goals above.

If you are looking for more advanced timers, check out gw2timer.com (not ours, but a good resource none-the-less). However, creating that type of advanced setup is NOT the goal here.



Using Git for WordPress plugin development.

I haven't used Subversion in years, and while I have done a lot of WordPress plugins over the year for work, they were all private and we never shared them on the registry.

I prefer to use git. I knew it had a svn sub-command however I've never used it. I spent the better part of a day trying to figure out how to push to WordPress's Subversion from git.

I tried to follow several guides but I kept getting Unable to determine upstream SVN information from working tree history, I spent hours googling it, eventually I came to the conclusion I have to use a different branch.

I thought I'd share this. might save someone few hours of frustration.
Continue reading


A simpler way to fight spam on WordPress

Update (2014-04-04) : The plugin is on now in WordPress's registry and on github, feel free to submit any patches.

There are 100s of different plugins that fight spam for WordPress, however almost all of them require user interaction someway or the other, and usually they require a remote service to verify the user's input.

While I was trying to combat spam on this site, I came across Anti-Spam, great concept, however it still required the user's interaction, and then my gears kicked in after analyzing the 1000s of spam comments that were posted on the site I wrote a very simple plugin to combat comment spam.

ChangeLog :

Continue reading


The performance of using interface{} vs a specific type.

I've recently started learning Go, and I have to say I'm very amazed by the whole concept of Goroutines, specially coming from a NodeJS / C++ background.

But sometimes it's nice to have a variable with a dynamic type, which Go does support (aka interface{}) , then I started wondering about the performance of using it vs just using one specific type.

I wrote a simple benchmark, at first I was rather disappointed at how slow it was compared to using the direct type, then I tried using goroutines to speed it up, with both buffered and unbuffered channels, surprisingly it didn't help at all, it even slowed it down farther.

Since the benchmark is simply summing some numbers, I decided to try atomic.AddUint64(), and while it was a tiny bit slower for defined types, it was much faster using interface{}

Continue reading