Skip to content

Instantly share code, notes, and snippets.

View vasi's full-sized avatar

Dave Vasilevsky vasi

  • Stripe
  • Montreal
View GitHub Profile
@vasi
vasi / tarpv
Created June 2, 2014 01:23
Create a tarball, using a progress bar
#!/usr/bin/env bash
# First arg is always option
arg1="$1"
shift
# Find first non-option
for i in "$@"; do
if [[ -z "$dir" && "$i" != -* ]]; then
dir="$i"
@vasi
vasi / LfsOsx
Created February 14, 2014 01:37
LFS on OS X from 2005 or so
= LinuxFromScratch using Mac OS X =
Linux From Scratch is a fun way to learn about Linux, but it expects you to already have Linux running. [http://trac.cross-lfs.org Cross-compiling] is already supported but OS X is a little weird--so here are some hints for bootstrapping LFS from OS X. I've only tried this on 32-bit PPC, I have no idea how well or badly it would work on G5 or Intel chips.
Generally, you can follow the [http://cross-lfs.org/view/1.0.0rc4/ppc/ Cross-LFS book], I only refer to areas where changes are needed.
== Chapter 2 ==
=== Partitioning ===
To perform the partitioning, you'll probably want to use a Linux rescue CD. Gentoo's PPC CD has a version of parted that can even resize existing HFS+ partitions non-destructively, I think Debian's does too. Using Disk Utility or a commercial tool like iPartition is an option, but I'm not certain they can create the special partition types Apple_Bootstrap and Apple_UNIX_SVR2.
@vasi
vasi / SortFi.js
Last active October 13, 2015 15:08
Sort Metafilter comments
(function(){
var resort = [];
$(".comments span[id^='favcnt']").each(function(i, e) {
if ($(e).html() != '') {
var grp = $(e).parents('.comments').prev('a').
nextUntil('a').andSelf();
var fav = parseInt($(e).text().split(' ')[0].trim());
resort.push({ 'fav': fav, 'elems': grp });
}
});
@marktheunissen
marktheunissen / htmlfiles_migration.inc.php
Created May 4, 2012 18:32
HTML Files Migration into Drupal using Migrate
<?php
class MyMigration extends Migration {
public $base_dir;
/**
* Constructor.
*/
public function __construct() {
parent::__construct();