Skip to content

Instantly share code, notes, and snippets.

@stanislaw
stanislaw / Keybase.md
Created February 27, 2018 15:56
Keybase.md

Keybase proof

I hereby claim:

  • I am stanislaw on github.
  • I am stanislaw (https://keybase.io/stanislaw) on keybase.
  • I have a public key ASCiwHfn7gYVr7FqXxfrYIBZmpQYEeW9PkFBUVwhQxx7Ygo

To claim this, I am signing this object:

@stanislaw
stanislaw / Beams.lus
Last active February 22, 2018 18:16
Kind2/Lustre examples for the Week 6 quiz on the course Formal Software Verification.
-- I am building a cancer treatment machine. The machine can emit two types of
-- beams; for simplicity let’s just call them A and B. There are two different
-- plates that can be placed in front of the beam; let’s call them 1 and 2. When
-- you turn the machine on it always starts ups with beam set to A and plate set
-- to 1. That is the initial state.
-- For safety reasons we never want the machine to be at beam B and plate 2.
-- If this every happens a deadline dose of radiation will be emitted and it
-- will kill the patient.
-- But all of the other combinations of beams and plates are valid.
@stanislaw
stanislaw / DYLDYN.cpp
Created February 21, 2018 21:48
Fixup selectors
// Resolve the relocations for all symbols we currently know about.
void RuntimeDyldImpl::resolveRelocations() {
MutexGuard locked(lock);
// Print out the sections prior to relocation.
DEBUG(
for (int i = 0, e = Sections.size(); i != e; ++i)
dumpSectionMemory(Sections[i], "before relocations");
);
@stanislaw
stanislaw / Communicator.h
Created February 15, 2018 14:07 — forked from rjungemann/Communicator.h
How to open a TCP socket in Objective-C
#import <Foundation/Foundation.h>
@interface Communicator : NSObject <NSStreamDelegate> {
@public
NSString *host;
int port;
}
- (void)setup;
@stanislaw
stanislaw / runtime-class.m
Created February 14, 2018 16:42 — forked from mikeash/runtime-class.m
Creating a usable class purely at runtime using the Objective-C runtime APIs.
// clang -fobjc-arc -framework Foundation runtime-class.m
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface Person : NSObject
- (id)initWithFirstName: (NSString *)firstName lastName: (NSString *)lastName age: (NSUInteger)age;
@stanislaw
stanislaw / Math-UTF8.md
Last active March 19, 2022 17:12
Common Math Symbols in Unicode, my cheatsheet for writing notes.
#include <stdio.h>
#include "gtest/gtest.h"
class MinimalistPrinter : public ::testing::EmptyTestEventListener {
void OnTestProgramEnd(const ::testing::UnitTest& unit_test) {
std::cout << "elapsed time: " << unit_test.elapsed_time() << "\n";
}
};
mull (master)*$ make -f Makefile.macos generate_fixtures
cd lab && make synchronize_fixtures
cd ./custom_test/ && make synchronize_fixtures
mkdir -p ../../unittests/fixtures/custom_test/distance/
cp ./build/*.ll ../../unittests/fixtures/custom_test/distance/
cp ./build/*.bc ../../unittests/fixtures/custom_test/distance/
cd ./google_test/google_test/ && make synchronize_fixtures
mkdir -p ../../../unittests/fixtures/google_test/google_test/
cp build/*.bc ../../../unittests/fixtures/google_test/google_test/
cd ./simple_test/mutation_operators/and_or_replacement && make synchronize_fixtures
tail call void @llvm.dbg.value(metadata %class.VirtualFunction_testEBOTA_Test* %0, i64 0, metadata !4469, metadata !4480), !dbg !4481
%2 = tail call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0)), !dbg !4482
tail call void @llvm.dbg.value(metadata %"class.std::__1::basic_ostream"* @_ZNSt3__14coutE, i64 0, metadata !4483, metadata !4480), !dbg !4490
tail call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 0, metadata !4488, metadata !4480), !dbg !4504
%3 = tail call dereferenceable(160) %"class.std::__1::basic_ostream"* @_ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m(%"class.std::__1::basic_ostream"* nonnull dereferenceable(160) @_ZNSt3__14coutE, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 17), !dbg !4505
tail call void @llvm.dbg.value(metadata %"class.std::__1::basic_ostream"* %3, i64 0, metadata !4483, metadata !4480), !dbg
_DEFUN(run_vector_1,(vector, p, func, name, args),
int vector _AND
one_line_type *p _AND
char *func _AND
char *name _AND
char *args)
{
FILE *f;
int mag;
double result;