Skip to content

Instantly share code, notes, and snippets.

@shlevy
shlevy / gist:1117118
Created July 31, 2011 19:35
Make command
gcc -O2 -fno-strict-aliasing -fPIC -W -Wall -Wno-unused -Wno-parentheses -pipe \
-fno-omit-frame-pointer -D_LITTLE_ENDIAN -DHEADLESS=true -DNDEBUG \
-DARCH='"amd64"'-Damd64 -DLINUX -DRELEASE='"1.7.0-release"' \
-D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT \
-D_LP64=1 -I. \
-I/tmp/nix-build-55kdkjjarl7b4gj2z4nq2jyh091b933d-openjdk-7b127.drv-0/openjdk/build/linux-amd64/tmp/sun/sun.awt/headless/CClassHeaders \
-I../../../src/solaris/javavm/export -I../../../src/share/javavm/export \
-I../../../src/share/native/common -I../../../src/solaris/native/common \
-I../../../src/share/native/sun/awt -I../../../src/solaris/native/sun/awt \
-DHEADLESS=true -I/nix/store/sr7i9zb5rkr6ca5nsdphyx2syjwg1dhz-cups-1.4.6/include \
@shlevy
shlevy / from-file-option.patch
Created August 8, 2011 20:26
Patch to add --from-file option to nix commands
Index: nix/src/libmain/shared.cc
===================================================================
--- nix/src/libmain/shared.cc (revision 28396)
+++ nix/src/libmain/shared.cc (working copy)
@@ -7,6 +7,7 @@
#include "misc.hh"
#include <iostream>
+#include <fstream>
#include <cctype>
@shlevy
shlevy / spawni.c
Created August 23, 2011 18:55
spawni.c comment
/* If no major work is done, allow using vfork. Note that we
might perform the path searching. But this would be done by
a call to execvp(), too, and such a call must be OK according
to POSIX. */
StringList1 = (1, [ 2, 3])
String2 = (2, "Hello")
String3 = (3, "Goodbye")
@shlevy
shlevy / os_unix.c
Created October 19, 2011 03:03
clang -c -O2 -D_FORTIFY_SOURCE=1 -o objects/os_unix.o os_unix.c
#include <string.h>
#include <unistd.h>
int mch_dirname(char *buf, int len)
{
return strlen(getcwd((char *)buf, len));
}
@shlevy
shlevy / gist:1832527
Created February 15, 2012 02:07
Run init() at start
if (document.readyState === "complete") {
init();
} else {
document.addEventListener("load", { handleEvent: init });
}
@shlevy
shlevy / gist:1876692
Created February 21, 2012 13:58
Strangeness with packageOverrides

$ cat ~/.nixpkgs/config.nix

{
  packageOverrides = pkgs: {
    testEnv = pkgs.buildEnv {
      name = "test";
      paths = [];
    };
  };

}

@shlevy
shlevy / expression
Created March 23, 2012 15:10
'with' infinite recursion
let
a = with b; { c = 2; d = c; };
b = a // { c = 3; };
in b.d
let
a = { c = 2; d = b.c; };
b = a // { c = 3; };
in b.d
@shlevy
shlevy / gist:2393408
Created April 15, 2012 15:23
UEFI NixOS on P8H67-M PRO
1. Download the latest 64-bit EFI-compatible ISO from http://hydra.nixos.org/job/nixos/trunk/iso_efi
2. Boot the cd in EFI mode. Enter into your UEFI menu, go to the boot options menu, and select your CD drive (Make sure you select the one that says EFI or UEFI boot! If a grub menu shows up you have not succeeded).
3. Use the 'gdisk' program to partition your drive. The interface is very similar to fdisk. Make sure you create one partition of type ef00 (EFI System Partition). This will be your /boot.
4. Format your partitions. Make the EFI System Partition a vfat volume.
5. Mount your partitions per the manual. Mount the EFI System Partition on /mnt/boot.
6. Follow the manual up to the stage of filling out your configuration.nix. The EFI specific portions of your config should be very similar to lines 31-43 of https://bitbucket.org/shlevy/dotfiles/src/11376b30c57e/nixos/p8p67-configuration.nix#cl-31 . See man configuration.nix, particularly the efiBootStub options, for more. Note that it is important to disab
@shlevy
shlevy / gist:2644261
Created May 9, 2012 12:47 — forked from patrickt/gist:2644080
EVERYONE ON TWITTER ONLY LIVES ONCE #yolo
javascript:(function(){$(".twitter-hashtag").html("#yolo");$(".js-tweet-text").each(function(idx){ v = $(this).text(); v = v.replace('Thanks', 'Thanks, OBAMA!!!'); $(this).text(v);})}())