Skip to content

Instantly share code, notes, and snippets.

View aqilc's full-sized avatar
🏠
Working from home

Aqil Contractor aqilc

🏠
Working from home
View GitHub Profile
@jbenet
jbenet / current_utc_time.c
Created July 17, 2011 16:17
work around lack of clock_gettime in os x
/*
author: jbenet
os x, compile with: gcc -o testo test.c
linux, compile with: gcc -o testo test.c -lrt
*/
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@azrafe7
azrafe7 / readChildOutput.c
Created November 16, 2012 18:28
read from process stdout
// Slightly modified code from http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx
// Ma non capisco perché non mi termina dopo aver stampato l'output
// E comunque popen continua a non funzionarmi (CodeBlocks with MinGW - gcc 4.7.2)
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
//#include <strsafe.h>
@mikesmullin
mikesmullin / x86-assembly-notes.md
Last active July 18, 2024 01:57
Notes on x86-64 Assembly and Machine Code

Mike's x86-64 Assembly (ASM) Notes

Assembling Binary Machine Code

Operating Modes:

These determine the assumed/default size of instruction operands, and restricts which opcodes are available, and how they are used.

Modern operating systems, booted inside Real mode,

@mdawaffe
mdawaffe / diff-changed-lines.sh
Last active October 4, 2023 08:38
Get line numbers of changed lines - git, diff - Full of bashisms
#!/bin/bash
# Call like you would `diff`
# `./diff-changed-lines.sh old new`
# Outputs the lines numbers of the new file
# that are not present in the old file.
# That is, outputs line numbers for new lines and changed lines
# and does not output line numbers deleted or unchanged lines.
@aqilc
aqilc / fetch.js
Created July 11, 2020 02:43
A simple fetch module.
// HTTPS API
import https from "https";
/**
* Executes an HTTP request
* @param {string | URL} url The url
* @returns {Promise<any>} The response
*/
export default (url, { method, headers, data } = {}) => new Promise((res, rej) => {
@disruptek
disruptek / languages-and-vms.md
Created October 22, 2020 21:05 — forked from haxscramper/languages-and-vms.md
languages-and-vms

Language & VM design

Lexing & parsing

Writing own parser

  1. nimly - Lexer Generator and Parser Generator as a Library in Nim.

    With nimly, you can make lexer/parser by writing definition in formats like lex/yacc. nimly generates lexer and parser by using macro in compile-time, so you can use nimly not as external tool of your program but as a library.

function overwrite(k, stats) {
const labels = ["PPS", "APM", "VS", "APP", "VS/APM", "DSPS", "DSPP", "CI", "GE"];
k.innerHTML = labels.map((l, i) => `<span>${meanstdev(stats.map(x=>x[i]).filter(x=>!isNaN(x)))}</span> <div>${l}</div> `).join('<br>')
}
function meanstdev(array) {
const n = array.length
const mean = array.reduce((a, b) => a + b) / n
const stdev = Math.sqrt(array.map(x => Math.pow(x - mean, 2)).reduce((a, b) => a + b) / n)
return mean.toFixed(2) + " \u00b1 " + stdev.toFixed(2);
// https://stackoverflow.com/a/53577159