This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import errno | |
import sys | |
from dataclasses import dataclass | |
import pyroute2 | |
@dataclass(frozen=True) | |
class NetworkConfig: | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
CHROOT=/var/lib/workbench/chroot # Empty | |
BASE_LAYER=/var/lib/workbench/chroot-base # already populated with /etc, /lib, /usr... | |
CHROOT_SIZE=20G # max size of user edits | |
VENV_PATH="/root/.local/share/virtualenvs" # only exits in dev | |
# /app/common (base layer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import socket | |
from c_clone import libc_clone | |
# Primer on global variables: we set these before clone(), so they're set in | |
# both the spawner process and the child process. Set them to None when they're | |
# no longer needed, to make code easier to read. | |
# | |
# Primer on pipes: `os.pipe()` creates two file descriptors: a "read" and a | |
# "write". Data written to the "write" end can (and must) be read by the "read" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
import os | |
import signal | |
from typing import Callable | |
libc = ctypes.CDLL("libc.so.6", use_errno=True) | |
# <linux/prctl.h> | |
PR_SET_NAME = 15 | |
PR_SET_SECCOMP = 22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
<fontconfig> | |
<dir prefix="default">.</dir> | |
</fontconfig> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
'use strict' | |
const fs = require('fs') | |
const util = require('util') | |
const paths = [] | |
for (let i = 1; i <= 20000; i++) { | |
paths.push(`small-files/${i}.txt`) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import email.message | |
import mailbox | |
# Just ignore these lines. | |
# Python's mbox reader finds a way to return Messages that don't | |
# have these super-important methods. This hack adds them. | |
setattr(email.message.Message, '_find_body', email.message.MIMEPart._find_body) | |
setattr(email.message.Message, '_body_types', email.message.MIMEPart._body_types) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
#require 'timeout' | |
require 'mysql2' # https://github.com/brianmario/mysql2 | |
def download_to_database(url, sql_statement) | |
res = Net::HTTP.start( | |
url.host, | |
url.port, | |
use_ssl: url.scheme == 'https', | |
open_timeout: 5, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'timeout' | |
require 'mysql2' # https://github.com/brianmario/mysql2 | |
def download_to_database(url, sql_statement) | |
Timeout::timeout(5) do # BUG. Never do this. | |
res = Net::HTTP.get_response(url) | |
sql_statement.execute(url.to_s, res.code, res.body) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Supplier < ActiveRecord::Base | |
end |
NewerOlder