Skip to content

Instantly share code, notes, and snippets.

View jbueza's full-sized avatar

Jaime Bueza jbueza

View GitHub Profile
@jbueza
jbueza / export-ibooks.js
Last active March 20, 2021 01:13
Export your iBooks (epub) on Mac OS X. Useful if you're moving your book collection away from Books.app (Mac OS X) to Calibre (open source and works on all major operating systems).
const fs = require('fs');
const plist = require('simple-plist');
const slug = require('slug');
const homedir = require('os').homedir();
const {execSync} = require('child_process');
const SCRIPT_NAME = 'ibooks export';
console.time(SCRIPT_NAME);
@jbueza
jbueza / download-webm.js
Created March 20, 2021 01:10
Using nodejs and axios to download webm file
const fs = require('fs');
const axios = require('axios');
(async () => {
try {
const {data} = await axios.get(SOME_URL_TO_WEBM_FILE, {responseType: 'arraybuffer'});
return fs.writeFileSync(`test.webm`, data, 'binary');
} catch (err) {
console.log(err);
}
@jbueza
jbueza / lol.css
Last active September 7, 2018 23:44
.trololol {
position: fixed !important;
top: 0 !important;
right: 0 !important;
background-color: red !important;;
}
seclorum 1 hour ago | link
I'm 42 and have managed to survive 25 years professionally in the computer world, primarily as a software developer.
There is one, hard, fast rule for survival as a developer, and it has worked very well for me for years. I will share it with you:
Follow the platform. Programming is all about the hardware.
How does it work? Its simple - programming on Windows for x86? Get yourself a Mac and learn to hack on it in your spare time (by the way: no television or other sedentary 'entertainment' activities - entertain yourself by learning new things). Already a Mac code - get an iPhone, or learn Android. An iOS developer already? Android master already? Alright then, time to get a Beagleboard and do some Linux hacking. Already hacked on Linux? Get into CUDA. CUDA genius already - okay, how about some of that Cloud tech ..
There is no safety in platform mastery, because those platforms are like slippery barrels, spinning around and around, slowly sinking into redundancy. If you are empl
@jbueza
jbueza / http-to-https.js
Last active April 15, 2016 16:19
NodeJS, Express, Elastic Beanstalk, Elastic Load Balancer (Redirect HTTP to HTTPS)
app.use(function(req, res, next) {
if ((!req.secure) && (req.get('X-Forwarded-Proto') !== 'https')) {
res.redirect('https://' + req.get('Host') + req.url);
} else {
next();
}
});

(from http://www.joyceleong.com/log/installing-phantomjs-on-ubuntu/)

  1. cd ~
  2. wget http://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2
  3. sudo mv ~/phantomjs-1.9.1-linux-x86_64.tar.bz2 /usr/local/share
  4. cd /usr/local/share
  5. sudo tar xvf phantomjs-1.9.1-linux-x86_64.tar.bz2
  6. sudo ln -s /usr/local/share/phantomjs-1.9.1-linux-x86_64 /usr/local/share/phantomjs
  7. sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
  8. phantomjs --version
@jbueza
jbueza / SomeCode.js
Created October 26, 2012 09:09
Provides an easy way of retrieving a specific entity by Partition and RowKey.
var Dre = require("dre");
var dre = new Dre(account); // account is just a JSON object with your Azure Storage keys
var Person = dre.model("People", dre.Schema({
FirstName: "string",
LastName: "string"
}));
Person.findOne({
var account = require("../test/fixtures/secret.json");
var Client = require("../lib/Client");
var client = new Client(account);
var person = client.define("People", {
PartitionKey: "dcb83fa0-15c4-463f-99b7-2ce365878b20",
RowKey: "58f92ada-2aa9-48f8-9429-4580e0f91b81",
FirstName: "Jaime",
LastName: "Bueza",
λ php_heroku: heroku create hello-php-jbueza
Creating hello-php-jbueza... done, stack is cedar
http://hello-php-jbueza.herokuapp.com/ | git@heroku.com:hello-php-jbueza.git
λ php_heroku: git init
Initialized empty Git repository in /private/tmp/php_heroku/.git/
λ php_heroku: git remote add heroku git@heroku.com:hello-php-jbueza.git
λ php_heroku: echo "<?php phpinfo(); ?>" >> index.php
λ php_heroku: git add . && git commit -m "PHP Time." .
[master (root-commit) 663c056] PHP Time.
1 files changed, 1 insertions(+), 0 deletions(-)
test:
@./node_modules/.bin/mocha \
test/unit \
--compilers coffee:coffee-script \
--reporter min
.PHONY: test