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
# https://www.berkshirehathaway.com/letters/2022ltr.pdf | |
berkshire_string = "49.5 (3.4) 13.3 77.8 19.4 (4.6) 80.5 8.1 (2.5) (48.7) 2.5 129.3 46.8 14.5 102.5 32.8 31.8 38.4 69.0 (2.7) 93.7 14.2 4.6 59.3 84.6 (23.1) 35.6 29.8 38.9 25.0 57.4 6.2 34.9 52.2 (19.9) 26.6 6.5 (3.8) 15.8 4.3 0.8 24.1 28.7 (31.8) 2.7 21.4 (4.7) 16.8 32.7 27.0 (12.5) 23.4 21.9 2.8 11.0 2.4 29.6 4.0" | |
sp_string = "10.0 (11.7) 30.9 11.0 (8.4) 3.9 14.6 18.9 (14.8) (26.4) 37.2 23.6 (7.4) 6.4 18.2 32.3 (5.0) 21.4 22.4 6.1 31.6 18.6 5.1 16.6 31.7 (3.1) 30.5 7.6 10.1 1.3 37.6 23.0 33.4 28.6 21.0 (9.1) (11.9) (22.1) 28.7 10.9 4.9 15.8 5.5 (37.0) 26.5 15.1 2.1 16.0 32.4 13.7 1.4 12.0 21.8 (4.4) 31.5 18.4 28.7 (18.1)" | |
def brackets_val(s): | |
if s[0] == '(': | |
return 1 - float(s[1:-1])*0.01 | |
else: | |
return 1 + float(s)*0.01 |
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
from random import randint | |
def change_mind(i_chose, host_opened): | |
if i_chose == 1 and host_opened == 2: | |
return 3 | |
if i_chose == 1 and host_opened == 3: | |
return 2 | |
if i_chose == 2 and host_opened == 1: | |
return 3 | |
if i_chose == 2 and host_opened == 3: |
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
cmake_minimum_required (VERSION 3.11) | |
project (YOUR_PROJECT_NAME) | |
set(CMAKE_CXX_COMPILER /Library/Developer/CommandLineTools/usr/bin/clang++) | |
set(CMAKE_CXX_STANDARD 17) | |
include_directories(SYSTEM /Library/Developer/CommandLineTools/usr/include/c++/v1) | |
link_directories(/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib) | |
set(CMAKE_EXE_LINKER_FLAGS -lc++) | |
add_executable(YOUR_PROJECT_NAME file another_file) |
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
# David Preece, 2017 | |
# In the public domain, provided "as is", author disclaims all warranties yah de yah de yah | |
# pip3 import requests | |
import json | |
import requests | |
def float_ecu(ecu): | |
if ecu == "Variable": |
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 sys | |
base_alloc = bytearray(int(sys.argv[1])*1024*1024*1024) | |
extensions = [] | |
while True: | |
print("Append 128MB") | |
sys.stdin.readline() | |
extensions.append(bytearray(128*1024*1024)) |
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/sh | |
mkdir -p /opt/root | |
mkdir -p /opt/root/.ssh | |
cd / | |
cp /root/.* /opt/root | |
cp /root/.ssh/* /opt/root/.ssh | |
rm -rf /root | |
ln -s /opt/root | |
touch /opt/root/.forward | |
echo 'real@email' > /opt/root/.forward |
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'?> | |
<!-- | |
Copy to /opt/custom/smf | |
Assumes Varnish was built on SmartOS with configure --prefix=/opt/local --mandir=/opt/local/man | |
By default it looks for a backend at localhost:8000 ... create one quickly with 'python3 -m http.server' | |
--> | |
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> | |
<service_bundle type='manifest' name='varnish'> | |
<service name='network/varnish' type='service' version='1'> | |
<create_default_instance enabled='true' /> |
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
// c++ -O3 -std=c++11 cache.cpp | |
#include <time.h> | |
#include <random> | |
#include <stdio.h> | |
using namespace std; | |
const int n_cachelines=65536; | |
const int bytes_cacheline=64; |
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 | |
echo "arc_stats::print -a arcstat_p.value.ui64" | mdb -kw > value.ui64 | |
ui64=$(cat value.ui64) | |
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw | |
echo "arc_stats::print -a arcstat_c.value.ui64" | mdb -kw > value.ui64 | |
ui64=$(cat value.ui64) | |
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw | |
echo "arc_stats::print -a arcstat_c_max.value.ui64" | mdb -kw > value.ui64 | |
ui64=$(cat value.ui64) | |
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw |