Skip to content

Instantly share code, notes, and snippets.

Vlad GURDIGA gurdiga

Block or report user

Report or block gurdiga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
gurdiga /
Created Aug 16, 2019
The Makefile I used to mangle some Optimizely logs
Make what?
sync: download upload
time aws --profile mx-optimizely s3 sync s3://optimizely-export-ng/10629356/10629356/2.0/2019/08/14/ 2019/08/14/
test -z "$(DAY)" && (echo "Give me a DAY, please. Something like DAY=08/21." && exit 1) || \
gurdiga / export-notes-to-plain-text.scpt
Created Jul 23, 2019
Export Apple Notes to plain text
View export-notes-to-plain-text.scpt
tell application "Notes"
repeat with eachNote in notes in folder "Log"
tell eachNote
set content to body as text
set {year:y, month:m, day:d, hours:h, minutes:n} to creation date
set m to m as number
set d to d as number
set n to n as number
set h to h as number
gurdiga / getCookieByName.js
Last active Feb 25, 2016
A little function to get a cookie by name. Useful to debug from the the browser console.
View getCookieByName.js
function getCookieByName(name) {
return unescape(
(document.cookie.split(/; /g)||[])
.filter(function(pair) {
return pair.split('=')[0] === name;

Per-directory Bash history (w/o aliasing cd)

I use Bash’s PROMPT_COMMAND variable:

The value of the variable PROMPT_COMMAND is examined just before Bash prints each primary prompt. If PROMPT_COMMAND is set and has a non-null value, then the value is executed just as if it had been typed on the command line.

The source code should be pretty straight forward, but if not, please ask in the comments. Put this in your .bashrc or similar:

# per-directory Bash history
View JS interface composition with

JS interface composition with promises

Inspired by Mr. Robert C. Martin’s episodes on SOLID principles that I’ve watched lately, and by the idea of “programming to interfaces” I’ve tried to come up with a schema that would allow me to have the concerns separated, but still composable.

These are a few modules from an Angular project.

So, I have an AuthenticationService module that does user account house-keeping:

// app/authentication-service/authentication-service.js
(function() {
View random-password.js
function randomPassword(lenght) {
function random() {
return parseFloat('.' + crypto.getRandomValues(new Uint32Array(1))[0]);
var characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
password = '',
for (i = 0; i < 10; i++)
mencoder dvd:// -mc 0 -noskip -ovc copy -oac copy -nosub -aid 131 -o Desktop/transcoded.avi

Web server comparison experiment: threaded Ruby vs. Node.js

Since a few weeks I’m working on a Node.js project at my day work, and I kind of loved the idea of the event loop, and then, because I just got off a Rails project, was wondering why wouldn’t that be possible with Ruby?

Googled a couple of evenings to find how Node.js manages to serve multiple requests on the same thread, and how its IO works. Then did the same for Ruby, read a bit about GIL, and found that in the end, there is not that much of a difference between what you can get from a threaded Ruby server and Node.js.

Played a bit with hello worlds and ended up with similar results from the speed and concurency standpoint: max 2 concurent requests on my 2CPU laptop.

For Ruby I spawn a separated Thread for every request. And from what I could google, Node.js uses a thread pool to handle the IO and one single other to run JS, which is kind of similar as far as I can understand these things. Now, I’ve tried hello world Rails and Sinatra proj

gurdiga /
Created Oct 8, 2013
Grunt task to run jasmine-node without PhantomJS when you don’t need it.

Grunt task to run jasmine-node without PhantomJS

I’m working on a project where I write a webservice on Node.js and I find that grunt-contrib-jasmine is a bit slow to start. I couldn’t find amy module on npm that would do that, so I wrote my own task:

grunt.registerTask('jasmine', [], function() {
  var exec = require('child_process').exec,
      done = this.async();

  var child = exec('jasmine-node --matchall test', function(error, stdout, stderr) {
    if (error) grunt.warn(error);
gurdiga / Wikipedia.css
Created Oct 3, 2013
Personalized Web Options for Wikipedia
View Wikipedia.css
#mw-content-text {
width: 40em;
#toc {
float: right;
margin: 0 0 1em 1em;
You can’t perform that action at this time.