instruction
stringlengths
71
95.1k
Splitting a string in tokens is a more complex topic than String.Split() wants to make us believe. There are at least three common policies according to which a string might be interpreted and split in tokens. Policy 1: Equivalent to String.Split() There is not much to mention about this policy. Given a string s and a ...
I am currently learning Haskell and as an exercise, I am building a simple tic-tac-toe program. I start with import Data.Vector data Cell = Empty | X | O type Board = Vector Cell and then, to render the board: render :: Board -> IO () render b = do renderSep renderRow 0 b renderSep renderRow 1 b r...
This is exercise 3.2.23. from the book Computer Science An Interdisciplinary Approach by Sedgewick & Wayne: Write a program that creates an array of charged particles from values given on standard input (each charged particle is specified by its x-coordinate, y-coordinate, and charge value) and produces a visualizatio...
I've created a simple function to work as a level, where the dot on screen is centered when the device is completely flat. It changes position based on device orientation. I use RxSwift to update the position of the dot. I'm relatively new to RxSwift, so I'm worried that I'm not using it correctly or to its full value....
I am not very fluent in C++ and want to construct a Kd-Tree in C++ based on this paper Efficient Locally Weighted Polynomial Regression Predictions, to use it to conduct some fast implementations of local linear regression . However, the speed for creating the tree and search( especially) is very slow. I have tried a s...
My goal was to create a script that would: Pull certain data from an existing SQLite table Apply a simple mathematical formula Save the new values to another SQLite table I’m just starting to learn Python (programming in general) and to be honest a lot of that is unclear to me. But using the internet and a lot of exi...
I was trying to do this question and I get TLE on one the test cases (the actual link to the question will ask you to login). What is an inversion? An inversion of an element is the number of elements to the left which are greater. Sum of number of numbers throughout a segment is the answer. It is based on Segment T...
Code functionality The following code tests whether the values that a user specifies for a lower bound and upper bound on two properties: The lower bound is smaller than the upper bound. The values are larger than 0 (positive). Since it first checks whether the lower bound is smaller than the upper bound, it implicit...
Here is my code: def printBoard(board): # this prints the board print(" | | ") print(f" {board[0][0]} | {board[0][1]} | {board[0][2]} ") print(" | | ") print("---------|---------|---------") print(" | | ") ...
I have been programming for about 4 to 5 months now and I made a login script with tkinter in python. I tried to use classes and function definitions as best as I could. To get to know them better. I wanted to ask you all, how does this code look and is there something I should or shouldn't do the next time I code? THA...
I am aware, that libraries exist for parsing python code, however, for the sake of learning how they parse errors, I'm creating a script that checks a file for only 6 Pep8 errors just for reference. This is how my current 6 Pep8 functions look (they append an issue to the issues list if the issue was found) """ [S001] ...
I am using a Deep Learning model I trained and want to improve its accuracy by implementing a rolling average prediction. I have already done it but want to improve it as I am making predictions on every 3 frames. Input: Each index represents a class and the respective prediction the model makes. Order is not alphanume...
I've written a short script to print a number to a string. This actually was very difficult for me to do -- I'm not sure if this is actually a tricky task or just because I'm so new to asm I was having a hard time. Here it is: SYS_EXIT = 60 SYS_WRITE = 1 SYS_STDOUT = 1 .section .rodata number: .long 774728 .t...
This is exercise 3.2.23. from the book Computer Science An Interdisciplinary Approach by Sedgewick & Wayne: Write a recursive Turtle client that draws dragon fractal. The following is the data-type implementation for Turtle graphics from the book which I beautified: public class Turtle { private double x; priva...
The following code asynchronously extract title from URLs (saved in book-urls.txt). from bs4 import BeautifulSoup import grequests links = list() file1 = open("book-urls.txt", "r") Lines = file1.readlines() for line in Lines: links.append(line) file1.close() reqs = (grequests.get(link) for link in links) resp = ...
I've created a Game of Life implementation in JavaScript with the goal of having it be as fast as possible, with the rendering I'm satisfied (see picture bellow), however the next state calculation is really slow and I'm out of ideas how to speed it up even more. Current state of the implementation Rendering Screenshot...
I have this program finding 2 numbers in the array (unsorted) so that its sum equal to the target sum. Here is my program: vector<int> findNumbers(vector<int>& nums, int target) { vector<int> result; for(int i = 0; i < nums.size() - 1; i++) for(int j = i + 1; j < nums.size(); j++) ...
My solution runs properly and I have tested it against various test cases. Is this the best approach? #include<stdio.h> #include<math.h> int primefactors(int); int main() { int num; printf("Enter a no:-\n"); scanf("%d",&num); printf("%d",primefactors(num)); return 0; } int primefactors(int n){ f...
I'm quite new to object-oriented C#. I wanted to test my knowledge by creating a Dog/Animal classes. I also tried to implement an IDangerous interface in my code. Is there anything I could've done better/differently? Again, this is my first time on this Stack Exchange so if I could've restructured this post differently...
This is how I implemented the guessing game - chapter 2 of the Rust book. use std::io; use std::io::Error; use std::cmp::Ordering; use std::num::ParseIntError; use rand::Rng; enum MyReadLineError { FailReadLine(Error) } #[derive(Debug)] enum MyReadU32Line { FailReadLine(Error), FailParse(ParseIntError) ...
I have written this regex to validate an email. It seems to work fine. Can someone advise on the regex used? Does it work properly or can be done in a better way? pattern=r"^[A-Za-z]+[-_$.A-Za-z]*@[A-Za-z]*\.[A-Za-z]+$" x=re.search(pattern,"abc.xyz@gmail.com) print x Note: I have used x and print as Code Review needs ...
I posted a recent question on code review detailing my previous C# object-oriented application which used animals as the main context. Although this example doesn't really include inheritance or anything similar, I did try and create something a little bit more interactive. Maybe, just maybe this could be practical for...
I'm currently working on an AI-driven trading system, the code below aims to extract ticker data from polygon REST API, this is a paid service so, in order to test the code you will need to subscribe / obtain a free API key with limited data history. You'll find base_extractor.py, polygon_extractor.py and extract.py wh...
Displaying Some Multiples Write a program to calculate the multiples of a given number. Have the user enter a number, and then use a for loop to display all the multiples of that number from 1 to 12. It is not necessary to use a function. You must use a for loop. /* * Code by Clint <https://github.com/clieg> * * ...
The reactor possesses its own thread to wait for messages in an event loop. Users should be able to start or stop the reactor at any point. These two operations are not required to be thread-safe. Users should be able to asynchronously register or remove message handlers from the reactor. It is possible that users may...
I assigned the following contrived problem in a comparative programming languages course to give students practice with "streaming": Write function that returns the top ten players by points-per-game among the players that have been in 15 games or more. The input to your function will be an object, keyed by team, with...
I've only been learning Java for two weeks, and I had to complete this task as part of my course. My instructor could not give specific feedback as answer file is already provided, the code works but I am just wondering what some of you might think of my code if it can be refined. It's a basic pizza ordering program. T...
Here is the solution-> //Write a program to check the number whether it is palindrome or not #include <stdio.h> int main(void){ //Put variables for the further proceed int number, quotient=1, remainder,i=0; //To declare a character array char text[100]; //To show the message to the user printf("Enter an integer numb...
Currently with a given Date and an Interval in Day, I can calculate all of the appointment in the future. for example if you are supposed to have an appointment each 30 day starting '2020-09-24', all the future appointments would be calculated like this. --Source Table Creation DROP TABLE IF EXISTS #DimDate CREATE TAB...
Using Excel, I have one sheet ("db") with data extracted from MES. I have to analyze this data and I need: Articolo, Fase, Tipo Confezione, TURNO, Macchina, avg and median. I searched everywhere how to get the median with SQL, but I found only how to get median for one item alone. Then I wrote this code, and I loop eac...
So I made an XML database for my music player where I store songs data (title,artist,album,genre,year) the code for generating the database is working but slow as heck, the code works as following diagram. |Aritsts Database >|Aritst ->(Name...
this is my first time on StackExchange. I am new to writing code. This is a singly-linked list I made in Java using generics with no sentinel nodes (i.e. no empty head and tail nodes). Looking for feedback on how to be more efficient, clean, and generally improve my code writing to include best practices. Each method...
I am trying to solve the open kattis problem '10 kinds of people' (https://open.kattis.com/problems/10kindsofpeople) using a best-first search algorithm and c++. 10 Kinds of People The world is made up of 10 kinds of people, those who understand binary and those who do not. These different kinds of people do not alway...
Often before the lecture starts, and occasionally in the break I like to display a timer with a countdown until the lectures starts/ resumes while playing some lofi-hip hop in the background. While the university students seems to enjoy this, I am ashamed of the code running the timer. So my lecture schedules is as fol...
I have coded a tool to produce precise timing events in Java. You set a value in BPM, and you receive events in your listener at the most precise timing it possibly can be with Java. It is basic. A thread, a loop, read the bpm value, invokes the listener (lambda), compute the time to sleep to match the bpm requested, a...
Im new to Python and Scrapy and Im trying to write a code that would find if a website contains a specific word in it. I need to scrapy many websites with different layouts so the search is a general one. I would appreciate if you could comment do you see a more efficient way on how to perform this task. Here is my sol...
I was inspired by a previous post here that also wrote a pizza ordering application. This is the attempt I have made using OOP in mind as I thought that would be just the way to go. Here is Pizza.java import java.util.ArrayList; public class Pizza { private String size; private ArrayList<String> toppings; ...
I have the following HTML + JavaScript code: <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <div class="container mt-4"> <!-- action="/reports_send/...
I would like to create a table where each column header contains a column name and a sort symbol. To do this, I'm using bootstrap. You can see my code below: .glyphicon-menu-down, .glyphicon-menu-up { display: block!important; font-size: 9px; } th { background-color: #0C69E8; } th { color: white; } th .ali...
In the past I had followed the Ray Tracing in a Weekend books using C++ because that was what the book used. However, recently I started thinking about how hard it would be to implement using C and whether I could do it. As a result I set a goal for implementing it using only C and I was able to mostly accomplish that,...
I have the following function that causes a significant visual jittering and lag in my access database - This is a treeview selection based on data in a table (tblDATA) with the fields: Object | Attribute | Property | Value I have tried echo and me.painting but figured my actual for loops need to be looked at for optim...
I've rewritten a piece of Javascript in Python 3.7 that decompresses a file compressed in a specific format. The project that I got this from is available here. The code I've come up with is as close an analog as I could interpret (I'm not the best at Javascript). def decompress_lz2(data): global loop_count lb_...
I created a TCP Server and Client and I really would like to know if its any good in regards of performance and code quality / safety. I hightlight the server and client class here. If you need more insight in the Helper classes I could share them as well. One thing I know is creating threads for each client is not rea...
This is a second shot at creating a Martingale betting simulator. The original code needed such heavy refactoring that I just started from scratch. Script simulates the Martingale betting strategy of betting a fixed amount until a loss occurs, at which point the bet is doubled to make up for the loss. This continues un...
I created a pretty straight forward snakes and ladders implementation in Java just for the heck of it. The program can be summed up as- Object of Board contains an array of Type Tile to represent the actual board. Object of type Tile contains an Enum data member to identify if its a regular tile or a snake/ ladder. A...
As part of my study, I decided to do this task from frontendmentor site. It's a short html code but I would like to learn good practices from the beginning. The problem I had encountered: Adding names to classes to make them readable What should I pay attention to when making the page accessibility In the code below ...
I have a piece of code that takes a dictionary as input and validates it based on the following rules: The dictionary has a key named items and its value must be a list Now, the list from point 1 must be a nested list with the length of each list should be 2 The first element ([0]) of every nested list must be of type...
I want to search for positions inside a range of integers. How to improve the code in terms of efficiency, since both my search list and the ranges are very big: #Range list with ids range_lst = [(121000, 122000, 'foo'), (123456, 124557, 'bar'), (156789, 163659, 'egg')] # Positions which we want to scan pos = [123456, ...
I wrote a simple, 2-player Pong game for a Udacity Nanodegree in C++. The program has the following class structure (relatively new to UML so any tips on here would be very much welcome too): Towards the end of the project, as I needed to add more features, my Game class started to do many many things (collision dete...
So I created a thread server that creates threads and associates them with a handle so that you can keep specific threads for specific tasks e.g. run all graphics rendering on thread 0, run physics stepping on thread 1 and use thread 2 for downloading a file of the internet etc. Personally I've found it useful in a pro...
The following code is a Node-based Netlify plugin to generate Content-Security-Policy rules based on inline styles and scripts. Inputs buildDir - a string for setting the build directory. exclude - an array of file paths to exclude from processing. (defaults []) policies - an object of policies in camel case, for exam...
To get the book list from https://www.java67.com/2015/09/top-10-algorithm-books-every-programmer-read-learn.html , I am using the following code in the console of the firefox DevTools: var select = document.querySelectorAll("div.post-body.entry-content div h3 b"); for (i = 0; i < select.length; ++i) { try { va...
The method works, but I would like to know if there is any way to make it more readable, optimized? I have user data (i want to import/update it). Accounts is finded by user data. User order data is entered into the system. userData.Id - user Id; userData.OrderNumber - user order number. The "UpdateAccount" method bel...
I've created a Node.js package that retrieves data from Icinga (a monitoring platform), formats it and passes it off to a class that generates some HTML and then sends it all out as an email. The email, in its simplest form, looks something like this: I come from a Ruby/Python background and this is the first time I'v...
I made a very primitive Tic-Tac-Toe using Python and I would like a grade on how well I coded the game. What code was there that could've been simpler or more efficient? And any advice you can give me? board = ['-','-','-','-','-','-','-','-','-'] request = None currentLetter = 'X' win = False def displayBoard(): ...
I use an online, simplified notebook. I'm able to add notes, delete notes, and edit existing notes. I find the code to be pretty unattractive and is heavily repeated. When I built this, I borrowed code from many sources (I was still learning web programming) and I had a hard time consolidating them. const pushToURL = (...
Motivated by yet another floating point question on stackoverflow, I decided to print a float value \$x\in[0,1)\$, i.e., the fractional part of a float (I might try printing whole floats later). But not the rounded value like print(x) does but the exact represented value. And only using basic operations: def print_floa...
So I was recently asked to complete the following challenge for an interview: Programming Problem Provide a production ready solution that accepts a new user name, validates a single string input as the password, and stores it locally. The solution should be written in C#/Xamarin with native UI (Android or iOS, your c...
This program is my attempt at solving the below problem: We have a function which is going to be called by multiple threads. The problem is to find a way to limit the number of times this function is executed per second given that we don't have a control over: a) The number of threads calling this function. b) The numb...
Im curious if my approach is correct in this case: I would like to get two DateTimes from a public property, but one of the dates i want them only if a user has purchase a feature or if he has not activate a switch, otherwise i want to get the same DateTime twice. More specifically, the way im getting the values now is...
I have the following query which retrieve all those who have ordered a book_id n°10 and but never ordered the book with id n°1. http://sqlfiddle.com/#!9/1bb9e8/44 |user_id | book_id | | 1 | 1 | | 1 | 2 | | 1 | 3 | | 2 | 1 | | 2 | 10| | 2 | 9 | | 3 | 5 | | 3 | 10| | 4 | 6 | | 4 | 7 | | 4 | 10| | 8 | 8 | select u.user_i...
I sometimes need to merge some big PDF files. Looking around I decided to use PyPDF2. All files are in the same directory as the script. The code works as intended and was tested with 5 small PDF files. I found many variations and decided to write this one myself: import glob from PyPDF2 import PdfFileMerger files = ...
I have a .NET application with a .config file that has content like this: <appSettings> <add key="SmtpConfiguration" value="Db" /> </appSettings> Inside the application's code I define an ISmtpConfiguration interface and several different implementations. DbSmtpConfiguration gets configuration data from a database...
If below piece of code has to be restructured to use but one single if-elif block, which is better? 1. or 2.? A = int(input("Enter an integer(1~30): ")) if A % 6 == 0: print("A is even") print("A is even and a multiple of 6 (6, 12, 18, 24, 30).") elif A % 10 == 0: print("A is even") print("A is e...
I've made a very basic wrapper over a String that offers mutability in place (context: mono/XNA, budget is about 11ms per frame, 0B (ZERO, NIL, НОЛЬ, NADA) allocations hard requirement). Before that I've used a wrapper over StringBuilder that essentially would do the same - get raw value of the string it operates on. p...
I have to register different callback functions to a scheduler. The callback signature defines a void * parameter. Some callbacks don't use a parameter. This works, but is it clean? I expected at least an incompatible pointer type warning for the missing cast on the parameterless call which I actually get when using a ...
I have piece of code where I draw output from model pixel by pixel: fun draw( canvas: Canvas) { val rotated = sensorOrientation % 180 == 90 var rotatedW = frameWidth; var rotatedH = frameHeight; if(rotated) { rotatedW = frameHeight rotatedH = frameWidth ...
I have many html files saved to my computer.they have same tags like this: Rpi-Cam-Web-Interface- Page 2 - forum and the page number changes I want to rename file to page number I use this code: import re import os pattern=re.compile('<title>RPi Cam Web Interface - Page \d*') for i in os.listdir(): parser=open(i,'r...
I've implemented a setTimeout thread similar to the one in JavaScript (new to thread programming) In the example on this page I see use of an atomic variable i which I think it to make sure no race conditions occurs on 'i', but from what I've read I don't think there is an atomic multimap. From the code a race conditio...
Expected Input: Enter the number of rows: 5 Expected Output: A A B A A B C B A A B C D C B A A B C D E D C B A I have solved this problem in this way-> //Write a program to build a pyramid with uses of alphabets #include <stdio.h> int main(void){ //Put variables here int space,num_of_rows,p=1,t=0...
I made the following snippet. It finds unique keys based on their values. For all keys \$s\$ that are contained in another key \$D\$ with the same value, key \$s\$ is discarded and key \$D\$ is returned. newdict = {} for key1, value1 in mydict.items(): for key2, value2 in mydict.items(): if ((key1 in key2) and (...
I had given a coding test for a job which failed. It had two problems and one of them is shared in this question along with my solution and other I already posted at this link. Problem: Find duplicate transactions. Description: Usually, due to any technical mistake, a single transaction is recorded twice in the databas...
i have made this time convertor this is my first project i am new to c++ and programming can you tell me if there is any way to write this code to be more efficient or this is code is ok. thanks for answering. #include <iostream> using namespace std; int main() { long double value; int input ; int input2; ...
I have a function which from an array of days return the array of days with it's date like from array of ['Sun', 'Mon', 'Tue', 'Wed' ] my function returns the days from today if there are some past days i switch the date to next week so the array will become ['Wed 23', 'Sun 27', 'Mon 28', 'Tue 29' ] And here is how my...
so obviously this SIMPLE code checks if the number is prime or not. I need to make it more advanced, easier to use, fewer lines or any improvement. while True: lista = [] try: num = int(input("Enter the amount of numbers: ")) for i in range(0, num): value = int(input("Enter the numbe...
Write a function make_human_move(current_player, board), which does the following: Print out the player's shape (e.g. if the player shape is 'X', the function prints "X's move"). Asks the human player for his/her move. The message asked is "Enter row and column [0 - 2]: ". A move consists of two integer values separat...
I am creating a VueJS component of an audio player. I am having some difficulties in finding the ideal way to get the arrow keys and space bar to work. I have found a solution, however I think it is not the best, nor the most effective. I've added an event listener to the DOM in the component, but the problem is that I...
I have a list of objects of class NameOwnersBasedOnRule with properties Name, Rule and Owner: var nameOwnersBasedOnRule = new List<NameOwnersBasedOnRule> { new NameOwnersBasedOnRule { Name = "Name1", Rule = "Rule1", Owner = "Owner1"}, new NameOwnersBasedOnRule { Name = "Name1", Rule = "Rule2", Owner...
edit: here is a cleaned-up version incorporating most (but not all) feedback, thanks guys; https://gist.github.com/divinity76/79efd7b8c0d7849b956cd194659c98e5 edit2, 2021-07-16: found a bug (possible security vulnerability, even?), it will fail on echo -ne "-ne", that can fixed that by adding $i !== 0 && before strpos...
I have the following which works but was wondering if there's a better way. Better meaning more efficient and or more compact. The function checks a trie to see if the word is in the trie. typedef struct nodeWords { char * word; int index; struct nodeWords *left; struct nodeWords *right; } nodeWords;...
I have a list and I need to get certain elements out of it. The way I did it was to compare the second list to the first list and then append to a third list. Here is my code: l1 = ["0 = 0","1 = 1","2 = 2", "And", "Something", "Wicked", "This", "Way", "Comes", f"zero.0 = 0", f"one.0 = 1", f"two.0 = 2", ...
I'm a student working as a research assistant and wrote this script to automate density functional theory HPC tasks with SLURM. When a calculation is complete the script checks the contents of a log file for the total force, and if it's above the desired threshold it generates a new input file, file.in.new, with relaxe...
I have an abstract Badge class, every class extending this class should always correctly set the incoming name (string) and achievedAt (date) fields. There might be other classes that extend the Badge class, which will get passed different types of values in their constructor (see examples below), the most important th...
I'm posting two similar solutions for LeetCode's "All Nodes Distance K in Binary Tree". If you'd like to review, please do so. Thank you! Problem We are given a binary tree (with root node root), a target node, and an integer value K. Return a list of the values of all nodes that have a distance K from the target node...
Currently trying to learn to add in some validations, but only run 2nd validation after the 1st one is fully done and has no errors. Just want to hear reviews regarding my current logic in my data validation. 1st Validation checks for empty fields 2nd Validation (only to work after 1st validation is done) checks if va...
As is known, the .container- class in Bootstrap 4.x.x and 5-alpha has an bug in intermediate classes. To give a little more detail, The container class of Bootstrap 5 .container, .container-fluid, .container-sm, .container-md, .container-lg, .container-xl, .container-xxl { width: 100%; padding-right: 1rem; paddin...
Follow up to this question: 10 Kinds of People Open Kattis Problem Time Limit Exceeded C++ Solves the puzzle linked in that question. I use Dijkstra algorithm to find items. The only twist is that each time I do a search I save the boundary list of the search in a Zone. On a subsequent search if my current "Zone" bumps...
I wrote this code. But it works very slowly. I'm figuring out how many times I have to run the case generator to find numbers less than or equal to inv, in this case six. I count the number of attempts until a digit <= 6 is generated. I find inv equal to 1 and repeat the loop. Until inv is 0. I will keep trying to gene...
The following is the program 3.2.6. from the book Computer Science An Interdisciplinary Approach by Sedgewick & Wayne: // This data type is the basis for writing Java programs that manipulate complex numbers. public class Complex { private final double re; private final double im; public Complex(double...
I am very new to Python and I am trying to learn through personnal projects and today I needed to collect a lot of baksetball player names and decided this was a good time to learn and practice. The script is able to pull out all of the players names, height, nationality and DOB but I need to enter the link to the page...
I'm building a Mozilla Firefox extension to hide link's formatting and show them as regular text. It consists of a script that runs on web-pages (content.js) that's activated by clicking on the extension (handled with background.js). On activation, a CSS rule is injected to hide link's formatting. Activating it again w...
I created the following program which takes a molecular formula as an input, eg CH3COOH and returns the molar mass of the compound: #! /usr/bin/env python3 element_weights = { 'H': 1.00794, 'He': 4.002602, 'C': 12.011, 'O': 15.999, 'Ts': 294.0, 'Og': 294.0, } def tokenize(string): position ...
So I wrote a a RESTfull api for a mongodb with python3.7, fastapi and mongoengine and id love to get feedback on how I should make my code more readable, clean, and dry. basically there are 4 main routes : Route to get all objects from a collection. Route to get one object from a collection by a specific identifier (...
I'm currently going over Robert Sedgewick Algorithms book. Here I'm implementing a Symbol Table using a Linked List. The Sequential Search Symbol table is implemented in JavaScript. The book mentiones that this Abstract Data Structure is not a good solution when dealing with big amounts of data. I would like feedback o...
I'm new to socket programming and c++. I have a the following method that sends an array to server and receives sum of the array, I tried to make it async. std::future<void> AsyncClient::ReqSum(const std::vector<double>& numbers) { return std::async( std::launch::async, [&, numbers]() { ...
For an API I have defined a "Client" struct which contains all the fields the client has in the database. When a GET request is made with the client ID the whole struct(The struct contains about 60 fields of different types) is returned with all available data. The request can be customized with a querystring "fields" ...
Today I discovered that it is possible to dynamically load code at runtime via dlopen and dlsym (and similar utilities on Windows as well). So the obvious next step was to call the compiler through system to build a piece of code into a shared object, which is then loaded to obtain a function pointer. All wrapped in a ...
I'm trying to implment memory allocator guided by this tutorial. I used a mix of Next-fit search and Segregated-list search. There are multiple slabs of different sizes (a slab is contagious blocks of memory of the same size, plus a header). If a slab ran out of free blocks, it allocates a new slab of the same size and...
My program brute-forces a password. The password is a string composed of a key and a four digit numeric code. The key is known so we are basically brute-forcing between 0000 through to 9999 An example password is: UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ 4143 I updated that script I wrote to take advantage of multiprocessing i...
This is a follow-up to Bash script to automate dev environment setup. In that question I'd thrown together a (sloppy) shell script to automatically setup my development environment. One of the answers suggested using Ansible and after a bit of reading realized it would help me with some configuration of remote servers ...