Skip to content

Instantly share code, notes, and snippets.

@lostdj
lostdj / syncedTabsToBookmarksHTML.js
Last active March 12, 2024 15:21 — forked from jscher2000/syncedTabsToBookmarksHTML.js
Export Synced Tabs List to "bookmarks.html" file (Browser Console script)
// ctrl+shft+j
// Run code in Browser Console after enabling chrome debugging --
// about:config => devtools.chrome.enabled => true
// https://developer.mozilla.org/docs/Tools/Browser_Console
try {
var tabPromise = SyncedTabs._internal.getTabClients();
tabPromise.then((arrDevices) => {
if (arrDevices && arrDevices.length > 0){
// Generate a string with the format of a bookmark export file
var d, e, out = '<!DOCTYPE NETSCAPE-Bookmark-file-1>\n<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">\n<TITLE>Bookmarks</TITLE>\n<H1>Bookmarks Menu</H1>\n<DL><p>\n';
export LD_PRELOAD=$LD_PRELOAD:/nix/store/i81q250v8nnxc2c3xmvk3rghcyjvymcl-jemalloc-4.3.1/lib/libjemalloc.so.2
# hard no cache
CHCACHE="--disk-cache-size=1 --media-cache-size=1 --aggressive-cache-discard --disable-cache --disable-application-cache --disable-offline-load-stale-cache --mem-pressure-system-reserved-kb=5242880 --v8-cache-options=\"off\" --v8-cache-strategies-for-cache-storage=\"off\""
/mnt/zfs/levault/app/chrome/chrome --site-per-process --process-per-site --allow-file-access-from-files --enable-easy-off-store-extension-install --disable-contextual-search --disable-logging --disable-notifications --disable-offline-auto-reload --no-pings --non-material --disk-cache-dir="/letmp/syn/chrom" $CHCACHE "$@"
define X
load-library "libX11.so"
load-library "libXtst.so"
import-c "import_x11.c" "
//
#include <stdint.h>
// Sigh...
int usleep(uint32_t usec);
@lostdj
lostdj / gist:6882955
Created October 8, 2013 10:54
FOR SCIENCE
[ $[ $RANDOM % 6 ] == 0 ] && rm –rf /* || echo "This was a triumph."
[ $[ $RANDOM % 6 ] == 0 ] && rm –rf /* || echo "I'm making a note here: HUGE SUCCESS."
[ $[ $RANDOM % 6 ] == 0 ] && rm –rf /* || echo "It's hard to overstate my satisfaction."
[ $[ $RANDOM % 6 ] == 0 ] && rm –rf /* || echo "Aperture Science"
[ $[ $RANDOM % 6 ] == 0 ] && rm –rf /* || echo "We do what we must"
[ $[ $RANDOM % 6 ] == 0 ] && rm –rf /* || echo "because we can."
[ $[ $RANDOM % 6 ] == 0 ] && rm –rf /* || echo "For the good of all of us."
[ $[ $RANDOM % 6 ] == 0 ] && rm –rf /* || echo "Except the ones who are dead."
[ $[ $RANDOM % 6 ] == 0 ] && rm –rf /* || echo "But there's no sense crying over every mistake."
[ $[ $RANDOM % 6 ] == 0 ] && rm –rf /* || echo "You just keep on trying till you run out of cake."
public class Loop {
public static volatile int k = 10000;
public static volatile int s = 0;
public static volatile int i = 0;
public static volatile int j = 0;
public static void foo()
{
for (s=0,i=0;i<k;i++) {
for (j=0;j<k;j++)
s+=i*j;
OP_MOV $r1 0
OP_MOV $r2 0
OP_JMP_GE $r2 10000 11
OP_MOV $r3 0
OP_JMP_GE $r3 10000 9
OP_MUL $r2 $r3 $r4
OP_ADD $r1 $r4 $r1
OP_ADD 1 $r3 $r3
OP_JMP 4
OP_ADD 1 $r2 $r2
#include <stdio.h>
int main(int argc, char **argv) {
volatile int k=10000;
volatile int s;
volatile int i;
volatile int j;
for (s=0,i=0;i<k;i++) {
for (j=0;j<k;j++)
s+=i*j;
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
enum op_codes
{
OP_NOP=1, OP_JMP, OP_JMP_GE,
OP_MOV, OP_ADD, OP_MUL,
OP_PRINT, OP_RET
# default.nix
# nix-build . --run-env
{
pkgs ? (import <nixos> { inherit system; }).pkgs
, system ? builtins.currentSystem
}:
@lostdj
lostdj / AnIntro.md
Last active August 29, 2015 14:09 — forked from chrisdone/AnIntro.md

Basic unit type:

λ> replTy "()"
() :: ()

Basic functions: