Skip to content

Instantly share code, notes, and snippets.

@sambacha
sambacha / lguest-docs.c
Created January 23, 2021 22:37 — forked from thoughtpolice/lguest-docs.c
lguest documentation
// Extracted from Linux 4.0 by running `cd drivers/lguest && make Beer`.
// Pasted with syntax highlighting to make life easier.
{==- Preparation -==}
[ arch/x86/lguest/boot.c ]
/*
* A hypervisor allows multiple Operating Systems to run on a single machine.
* To quote David Wheeler: "Any problem in computer science can be solved with
* another layer of indirection."
*
@sambacha
sambacha / stack-example.md
Created January 23, 2021 22:46 — forked from julianjensen/stack-example.md
Function mechanics and stacks in gory technical detail

Some quick assembly language notes required for the following. You'll need to understand three registers on the Intel CPU.

First, the rip register. On a 16-bit CPU, it's called IP (for Instruction Pointer), and on a 32-bit CPU, it's called eip (for extended instruction pointer), but on a 64-bit modern processor, it's called rip. It holds the index (or offset or number) of the memory location where the CPU is currently executing instructions from. As it reads instructions from memory, it increments to get to the next instruction and so on. Some instructions can cause it to jump to a non-sequential read, such as a branch, jump, call, or return, for example. You can also write to it directly but this is rarely done in practice.

Second, the rsp register (also sp on 16-bit and esp on 32-bit) is the stack pointer. It points to the top of the stack. The stack grows downward. In other words, if the rsp points to memory address 10000 and you push a 32-bit number (4 bytes) onto the stack, then afterward

--log_gc (Log heap samples on garbage collection for the hp2ps tool.)
type: bool default: false
--expose_gc (expose gc extension)
type: bool default: false
--max_new_space_size (max size of the new generation (in kBytes))
type: int default: 0
--max_old_space_size (max size of the old generation (in Mbytes))
type: int default: 0
--max_executable_size (max size of executable memory (in Mbytes))
type: int default: 0
@sambacha
sambacha / node-npm-in-docker.sh
Created February 6, 2021 07:32 — forked from artemgordinskiy/node-npm-in-docker.sh
Run Node/NPM in a Docker container
# For example, run "npm install"
docker run -v "$PWD":/usr/src/app -w /usr/src/app node:4 npm install
# This command creates a container (downloading one first if you don't have it locally), runs the command in a current directory and quits the container
# Great Success!
@sambacha
sambacha / Info.plist
Last active February 12, 2021 12:27 — forked from pnc/ocr-shot.sh
OCR
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AMFolderAction</key>
<string>AMAddingFolderItems</string>
</dict>
</plist>
@sambacha
sambacha / z-automator.png
Created February 13, 2021 05:40 — forked from lrytz/z-automator.png
Shortcut for Syntax Highlighting in Keynote
@sambacha
sambacha / markdown_doc
Created February 24, 2021 08:07 — forked from jiffyclub/markdown_doc
This script turns Markdown into HTML using the Python markdown library and wraps the result in a complete HTML document with default Bootstrap styling so that it's immediately printable. Requires the python libraries jinja2, markdown, and mdx_smartypants.
#!/usr/bin/env python
import argparse
import sys
import jinja2
import markdown
TEMPLATE = """<!DOCTYPE html>
<html>
@sambacha
sambacha / Makefile
Created March 12, 2021 21:07 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@sambacha
sambacha / savePastDiscordChat.py
Created March 13, 2021 14:57 — forked from NNTin/savePastDiscordChat.py
goes through a text channel's chat log and writes it to a file
import discord
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
@sambacha
sambacha / create-react-app-webpack-prod.md
Created April 8, 2021 02:20 — forked from sriramrudraraju/create-react-app-webpack-prod.md
Optimizing production build create-react-app using svg-url-loader

Create-React-App Production build Optimizataion

Svg-Url-Loader

Requirement

Instead moving .svg files from src/assets/ to build/static/media/ during npm run build. .svg files have to be bundled into build/static/js/main.js

Steps