/dpt/ - Daily Programming Thread

What are you working on, Holla Forums? Don't be shy about asking for help or code review. Keep your posts on-topic, please.

Hastily written roll script for the challenge image:
0x0.st/7ML.txt

Didn't bump the other thread because it was bait

Other urls found in this thread:

play.rust-lang.org/?gist=71c286cf4179564b313e5d26f867ec22&version=stable
play.rust-lang.org/?gist=ae2c928c71ba0c4ca196c24f9971788b&version=stable
play.rust-lang.org/?gist=b877be72ceb638edb5ec2dea98c67d7f&version=nightly
rust-lang.org/en-US/friends.html
bugs.debian.org/cgi-bin/bugreport.cgi?bug=873492
flutter.io/
keccak.team/keyak.html
point-at-infinity.org/jsaes/
github.com/ricmoo/aes-js
0x0.st/Flb.tar
pastebin.com/raw/igjks61e
pastebin.com/raw/tm3hSgis
my.mixtape.moe/usrukd.zip
en.wikipedia.org/wiki/Mersenne_Twister
pcg-random.org/
cs.hmc.edu/~oneill/index.html
youtube.com/watch?v=45Oet5qjlms
en.cppreference.com/w/cpp/numeric/random/linear_congruential_engine
pcg-random.org/download.html
play.rust-lang.org/?gist=47b9e5a7fae6774990fa8ab7a552cecc&version=stable
github.com/yooow0t/url-obscurification/blob/master/README.md
github.com/yooow0t/url-obscurification
github.com/yooow0t/message-encoder
paulinternet.nl/?page=bicubic.
adventofcode.com/
youtube.com/watch?v=P5iqYuFmzqg
redblobgames.com/pathfinding/a-star/introduction.html
badplanchan.net
discord
twitter.com/SFWRedditVideos

unixtime(this_post) % 145, how fucked would I be?
not doing anything on this list because I've got enough shit to do as is

well that's fucking boring.

Holla Forums doesn't program

Trying out embedding/extending. I'm both regretting the fact that I wrote custom file formats for config files instead of using Lua but also excited by getting a REPL inside my program.

Trying to identify islands in an image but I'm retarded. I want to hilight regions as if by using a fuzzy select and then get data such as dimensions, color vs global values and surrounding islands to feed into another program.

I decided to make a terminal-based browser of sorts. Instead of using HTML and CSS, it uses it's own format. Each page is a YAML file with a list of instructions, such as drawing a border or line, or adding text. It supports foreground and background colours too. It assumes the terminal is 80x24 for now, but I'm planning on expanding that.
It's mostly an excuse to mess with dispatch tables. The main loop for processing each instruction is a simple:
for (@{$yaml->[0]->{draw}}) { $draw{$_->{command}}->($_);}

No, what we do is
BROGRAMMING!

>>>Holla Forums

...

...

What are some employable things to learn?

Django
ReactJS & Angular (how common?)
Firebase (for android dev.. don't really know what's common 'stack' there or just plain android SDK)
Java EE (that shit gives me cancer.. everything has a dependency of dependency with their separate XML config files)

I'm too dumb to work with C, sure I can use it for hobby projects but I suck at math and logical thinking.

Let's see what I get.

...

well i guess math only. i can do threading and stuff like that but often C programs have things that really need math like reggressions or quaternions.

Is there list of syntax changes like that somewhere? @* just brings up irrelevant stuff.

Learning how to use gtk and learning gui programming in general. It seems pretty easy when doing small helloword programs, and I don't really see it getting more complex than just managing events.

What are you using to learn gtk?

The tutorials on the Gnome Developer site. It probably isn't the best way to learn it, but it seems to cover most of the important concepts like frames and events and such that you would expect out of a GUI library.

...

...

Qt

programming challenge:
create an image file that contains its own md5 hash.

...

I tried programming, but i had trouble implementing a linked list as an object, so maybe I'm just retarded. Goodbye, off to kill self. Gonna stay a mechanic and just enjoy computers as a hobby.

Hey Angular guys, help me out on something. I'm a newb to the framework and I can't figure out this basic thing: Say I have a parent component, inside it is a child component with the directive *ngFor. Now say my parent component has a button. When I click that button, how can I make all of my child components run a particular method?

...

Don't worry too much about it, just knowing what linked lists are puts you above a fuckton of programmers.
What language are you trying it in?

What did they mean by this?

The OOP meme claims another victim.

Found your problem.

Our team is proposing an OS architected entirely around circles and the mathematical beauty of Pi. We eliminate all rectangular elements, which represent the lesser reptilian brain, by the grace of God. It shall be called CYCLESOS. It will have an API to interface with all non-rectangular elements of TempleOS via 9-pin round connectors. We begin by eliminating all support of any draw calls to 90 degree angles.

As part of our mandate, all data structures will be cyclic graphs.

Today I implemented general problem solver in Erlang.
What are you working on, Holla Forumsnologists?

Software clone of a hybrid wavetable synthesizer of the 80s. VST/LV2 and C++
I am collecting information on the analog filter and I try to find a fitting model.

Hardmode: sha-256

Hey, tech! Is there any good way to authenticate RSS users? I want expose my app's feed as RSS but each user has some private data in his feed, so I do not want everyone to have access to that data.

Rolling.
Trying to improve my Go.

I've never programmed python before (Only know C, x86 (32 and 64 bit) ASM, z80 ASM, C++, a little amount of C#, and some haskell. I decided to take a jab at writing some python code. I want you all to tear me apart here. Give me everything I did wrong, why I suck,
and what I need to read.

Ignore the while 1, thats just cause I was lazy. And the two random gens are one for letters, one with letters and digits. I guess I should make the user choose which one rather than editing the code.

import sysreload(sys)sys.setdefaultencoding('utf8')import urllibimport random, stringfrom BeautifulSoup import BeautifulSoupimport osfrom termcolor import coloredheader = " ==== URL SHORTENER FUZZER === "def randomword(length): letters = string.ascii_letters letters = letters.replace(" ", "") return ''.join(random.choice(letters) for i in range(length))def randomall(length): letters = string.ascii_letters + string.digits return ''.join(random.choice(letters) for _ in range(length))def GrabWebsite(site): link = site + randomword(6) reply = urllib.urlopen(link) code = reply.getcode() if code == 404 or code == 403: back = "1 " + link else: soup = BeautifulSoup(urllib.urlopen(link)) if soup.title is None: back = "No Title" else: soup = soup.title.string if soup is None: back = "No Title" else: back = link + " : " + soup.decode('utf-8') return backdef stats(siteOUT, ranAlready, FourOFour, TwoHundos): print colored(header , "green") + "\n\n" print colored("404's : ", "red") + colored((str((FourOFour / (ranAlready * 1.000)) * 100) + "%"), "red") print colored("200's : ", "cyan") + colored((str((TwoHundos / (ranAlready * 1.000)) * 100) + "%"), "cyan") return 0;os.system("clear")print colored(header, "green") + "\n\n"site = raw_input("Website to fuzz: ")os.system("clear")x = 0FourZeroFour = 0TwoHundos = 0f = open("FuzzOut.log", "w")f.closefile_object = open("FuzzOut.log","r+")file_object.write("T\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")while 1: file_object.seek(0) x += 1 siteOUT = GrabWebsite(site) if siteOUT[0] == "1": FourZeroFour += 1 else: TwoHundos += 1 file_object.seek(x) file_object.write(siteOUT.encode('utf-8')) file_object.seek(0) os.system("clear") stats(siteOUT, x, FourZeroFour, TwoHundos) readfile = file_object.readlines() print "URLBeingRan: " + siteOUT[2::] print "\n\n ---- LAST 10 FOUND SITES ----" for line in readfile[-10::]: print line

roll

fuck reroll

roll

reroll????

roll

had to install rust and microshit visual c++ build tools first
play.rust-lang.org/?gist=71c286cf4179564b313e5d26f867ec22&version=stable

Visual C++ thing is required only if you are using Rust on windows.
Why are you calling them microshit if you support them by using their product?

im currently visiting my parents and didn't take my laptop with me, so i enriched my mothers laptop with rust

roll

IP...
Tracking...
Visualization... ?

I know what all of those words mean...

I hope you obtained her consent before culturally appropriating her precious megabytes

Use Python 3 instead of 2, and get off Windows. This is just generically bad code, it doesn't even reach the stage of being bad Python.

Your random* functions duplicate functionality and the only difference is the data they use. Make it a single function and pass "letters" as an argument (this will also make it more convenient for you to change depending on user input). Also, consider generating "letters" variables at the top-level instead of every single time you call these functions.

The code in your top level below the stats function should be moved into its own scope. You could wrap it in a main function and call it after checking that Python is calling the script directly.
if __name__ == "__main__": main()

With those os.system("clear") calls, overly complicated prints, and that log file, I think you miss the point of how stdout/stderr is meant to be used. You should be using them to log (you can redirect stdout to a file).

By the same token, you should prefer using command line arguments over raw_input() to get input. Interactivity like this just makes your script inconvenient to use.

You said to ignore that infinite loop, but you really should at least surround it with a try-except, so you can catch any KeyboardInterrupt and terminate your program gracefully (e.g. by closing files).

There's probably more but these are a few initial criticisms. Don't worry, many beginners write code like this.

Honestly feel bad about coming here because I'm working on homework and it just seems I'll never be good because I feel like I can't into clever, non-pajeet solutions.

C++. I actually got it done, but it was hell, and I have a bug where I can't delete the last node in the list.

post your assignment. i will give you a clever solution in rust

I'd rather not, because prof considers it cheating to ask for outside help, and I'm sure he browses these boards. Also
Why is this popular?

wtf????

I mean, I suspect he does. I'll post it, but don't post any code. I'm actually right about done with it, but I suspect everyone has it easier than me in this class. • Create an empty set and add items to it. Uniqueness of items within the set must be maintained • Deletion of an item from the set. This deletion must not lose any data other than the given element to be deleted. • Print out the elements currently contained within the set. They will be printed out as {element1, element2, …} • Union between sets, as defined in class • Intersection of sets, as defined in class • Difference of sets, as defined in class • In this archive there are 4 small data files int1, int2, int3, int4. Each one represents a set. Your program will load the data from each list into individual sets and be able to evaluate the following three set equations (Note S1 refers to the set found in int1, S2 to int2, …). We may test your program using different (but similarly sized) data sets, so your program should be able to handle files specified by the user as opposed to hard coding the file names in. Your program must print out each equation, and then display the result. Display of the work during intermediary steps is not necessary for the final submission, but it may be helpful for debugging purposes during coding. You will NOT be counted off if the work is left in the final submission. Example output: EQ1: S1 ∪ (S2 - S3) = {1,2,3,4,5,6,7,8,9,10} ◦ ((S1 ∪ S4) – S3) ∩ S2 ◦ (S1 ∩ S2) ∪ ((S3 – S2) – (S4 – S1)) ◦ S4 – S3 – S2 – S1 ◦ (S3 ∪ ((S1 – S3) ∩ (S2 ∪ S4) A basic hash table implementation will be provided, bonus points will be given if you create your own implementation. Each implementation and the resulting analysis is worth 1/3 of the assignment grade. Due to the small size for most of the datasets, we will do this analysis by counting the loop iterations our various set operations go through as opposed to a time metric. As an example, the loop in the pseudocode below will execute the inner loop between 1 to m times, where n is the size of the array, and the outer loop 1 to n times, giving it a big-O of O(m*n). for(int i = 0; i < set.size(); i++)for(int j = 0; j < array.size(); j++) if(set[i] == array[j]) break

play.rust-lang.org/?gist=ae2c928c71ba0c4ca196c24f9971788b&version=stable

HTTP Basic Auth

Python already has sets, but I implemented a new one with those requirements.
class Set(object): "A set implementation." def __init__(self, *args): self.items = [] for arg in args: self.add(arg) def __str__(self): "String representation of this object." return "{"+", ".join(self.items)+"}" def __repr__(self): "The representation of this object." return "" def __add__(self, other): "Add an item based on its type." if isinstance(other, Set): return Set(*(self.items+other.items)) elif isinstance(other, list): return Set(*(self.items+other)) else: raise TypeError("Can only concatenate list or Set (not \"{}\")" .format(type(other))) def __or__(self, other): "Does an union with another set." assert isinstance(other, Set), \ "other object is not a Set" return self.union(other) def __and__(self, other): "Does an intersection with another set." assert isinstance(other, Set), \ "other object is not a Set" return self.intersect(other) def __xor__(self, other): "Returns the difference of two sets." assert isinstance(other, Set), \ "other object is not a Set" return self.difference(other) def __getitem__(self, key): "Returns an item on index key." return self.items[key] def add(self, item): if not item in self.items: self.items.append(item) def remove(self, item): assert item in self.items, \ "Item not in set" self.items.remove(item) def union(self, other): return self + other def intersect(self, other): concat = self.items + other.items intersect = [i for i in concat if i in self.items and i in other.items] return Set(*intersect) def difference(self, other): concat = self.items + other.items difference = [i for i in concat if not (i in self.items and i in other items)] return Set(*difference)if __name__ == "__main__": a = Set(1, 2, 3) print(a) # {1, 2, 3} print(repr(a)) # print(a + 7) # {1, 2, 3, 7} print(a + Set(4, 5, 6)) # {1, 2, 3, 4, 5, 6} print(a | Set(2, 3, 4, 5)) # {1, 2, 3, 4, 5} print(a & Set(2, 3, 4, 5) # {2, 3} print(a ^ Set(2, 3, 4, 5)) # {1, 4, 5}

There are a few bugs in this, here's the fixed version: class Set(object): "A set implementation." def __init__(self, *args): self.items = [] for arg in args: self.add(arg) def __str__(self): "String representation of this object." return "{"+", ".join(map(str, self.items))+"}" def __repr__(self): "The representation of this object." return "" def __add__(self, other): "Add an item based on its type." if isinstance(other, Set): return Set(*(self.items+other.items)) elif isinstance(other, list): return Set(*(self.items+other)) else: raise TypeError("Can only concatenate list or Set (not \"{}\")" .format(type(other))) def __or__(self, other): "Does an union with another set." assert isinstance(other, Set), \ "other object is not a Set" return self.union(other) def __and__(self, other): "Does an intersection with another set." assert isinstance(other, Set), \ "other object is not a Set" return self.intersect(other) def __xor__(self, other): "Returns the difference of two sets." assert isinstance(other, Set), \ "other object is not a Set" return self.difference(other) def __getitem__(self, key): "Returns an item on index key." return self.items[key] def add(self, item): if not item in self.items: self.items.append(item) def remove(self, item): assert item in self.items, \ "Item not in set" self.items.remove(item) def union(self, other): return self + other def intersect(self, other): concat = self.items + other.items intersect = [i for i in concat if i in self.items and i in other.items] return Set(*intersect) def difference(self, other): concat = self.items + other.items difference = [i for i in concat if not (i in self.items and i in other.items)] return Set(*difference)if __name__ == "__main__": a = Set(1, 2, 3) print(a) # {1, 2, 3} print(repr(a)) # print(a + [7]) # {1, 2, 3, 7} print(a + Set(4, 5, 6)) # {1, 2, 3, 4, 5, 6} print(a | Set(2, 3, 4, 5)) # {1, 2, 3, 4, 5} print(a & Set(2, 3, 4, 5)) # {2, 3} print(a ^ Set(2, 3, 4, 5)) # {1, 4, 5} print(a[0], a[1], a[2]) # 1 2 3

without macros: play.rust-lang.org/?gist=b877be72ceb638edb5ec2dea98c67d7f&version=nightly

No, use python 2. There's nothing good in python 3 that hasn't been backported. The only thing 3 gives you is reduced library compatibility. Skip 3, wait for 4.

I did rust for a while, but the syntax really stikes me as very explicit. I'm looking to write either a blockchain or a kademlia DHT with it. I'm waiting for these recent RFCs that go accepted to be implemented (GATs are gonna be dope)

I'm reading haskell from first priciples, lambda calculus is fun, I'm going t use it for blockchain related adventures.

...

...

Are you brain damaged?

In computer science a fundamental law is that if I have one Turing Machine I can build any other Turing Machine. If I have COBOL then I can bootstrap a compiler for FORTRAN (as disgusting as that might be). If I have FORTH, then I can build an interpreter for Ruby. This also applies to bytecodes for CPUs. If I have a Turing Complete bytecode then I can create a compiler for any language. The rule then can be extended even further to say that if I cannot create another Turing Machine in your language, then your language cannot be Turing Complete. If I can't use your language to write a compiler or interpreter for any other language then your language is not Turing Complete.
Currently you cannot run Python 2 inside the Python 3 virtual machine. Since I cannot, that means Python 3 is not Turing Complete and should not be used by anyone.

...

I thought you were retarded at first, but now I see you're just pretending.

Give me a reason to use python 3 that isn't because the number is bigger.

* Increased syntactic consistency
* Unified type for real numbers
* Better standard library

rust has all of those and much more

Does it have sane people using it?

Also included in rust:
* horrible syntax
* not adopted widely
* fewer learning resources available (compared to C/C++)
* Vec
* CoC
* Steve Klabnik

rust-lang.org/en-US/friends.html


>Vec
kys
for a language that is ~2.5 years old it's adoption is quite good
it doesn't need as many because it isn't such a clusterfuck as c++

The adoption is just the beta tester generation. Once Rust actually releases anything stable they'll move on to the next corporate abortion.

T.N. kys means "you're right"

Oh yeah, that's way better than having compatible libraries. Good job.
Who the fuck uses real numbers in raw python? Everyone that needs those uses numpy.
Everything was backported or replaced with a less braindead library (see: asyncio).

Once again, the python 3 crowd showing they really just use it because the number is bigger and don't know any better.

>changing syntax between MAJOR versions is bad
Not an argument. This is obviously an improvement.
Backported, causing months of duplicated effort.

Once again, the python 2 crowd showing they really just use it because it's hip and cool to dislike things other people do.

I'm still laughing that you even brought this up as a reason to use python 3. You must have never used them.
How the fuck would this matter for my decision to use python 2 or 3? The reality today is that python 2 and 3 are nearly identical other than python 3 having WAY less library compatibility. Even flup doesn't have an official python 3 version and Debian doesn't maintain it[1]. How much duplicated effort would it be for me to port and maintain all the libraries I need? Fucking LARPing moron.

[1] bugs.debian.org/cgi-bin/bugreport.cgi?bug=873492

In C++, why isn't it legal to pass an array of ifstream type pointers to a function? Seems I can open the files into that array, but cannot traverse the array once passed.

Post code, you sound like you don't know what you're doing.

If only you knew how right you were.

std::ifstream fileno[4]; for(int i = 0; i < 4; i++){ fileno[i].open(argv[i+2]); if(!fileno[i].is_open()){ errorMessage(1); exit(1); } } f(&fileno);

So that's how it starts. Seems to go just fine, and the passing to a function just breaks.

What I'm trying to do once it gets to that other function is this
for(int i; i < 4; i++){ while(*file[i] >> x){ h[i].push(x); }}

Different user - pass it as f(fileno) to a function defined as void f(std::ifstream *fileno). While you could do void f(std::ifstream (&fileno)[4]), that's disgusting, don't do it. It's awkward if you learned C++ before C because this is where C++ shits the bed but C programmers don't notice as they'd not have tried doing it.

Tried that.

You'll also need to access it like (*file)[i].

Ah, that probably makes the difference.

I'm not using windows, have been using linux for the last 6 years. And Void linux for 3.

Oh yeah I removed the extra random function and made a toggle at the beginning to allow you to choose specifics by editting the Ascii strings to include different characters.

Taken note on the stdout going to work on that now. Also with the command line args.

Thank you a lot man, I appreciate the help

Learning programmers on Windows are notorious for using os.system(), hence my false assumption. Also, I realise I didn't explain enough about stdout/stderr.

A good general rule is to use stdout for nothing other than logical program output (in your case, that might be something like the URL followed by title for every site you find). This allows you to pipe the output of your script to another script to perform tasks without having to worry about filtering out unrelated messages. stderr is then used for debug/error/info/diagnostic information that you wouldn't typically want sent to another program.

If you do want to make a nice interactive UI for your program, you can look into using something like tkinter/gtk/qt for a GUI or curses for a terminal-based interface. Programming for a UI requires a bit more legwork than throwing together a script.

Glad you got something out of it.

Having fun with dates. DST is like a spot of sunshine in an otherwise sane world.
I mean why would day+1 == day+1.

Is there a usual SDK version / minSdkVersion that is used for new android apps? I need to quickly learn and want to focus on relevant things.

use flutter.io/
it is the future of mobile dev

no

not an argument

But can it solve my alimony payments

as of now flutter is a meme. still in alpha.

I have to write a cross platform iPhone/Android app with AES encryption, bluetooth, networking, and use of a lot of fragments. at least fragments are what they're called in Android. I was looking at cordova, but even in that the bluetooth support isn't looking the best. need to use plugins. anyone have a suggestion of what I should use?

kek. use keccak for crypto
keccak.team/keyak.html

So apparently my compsi prof uses Allman-style brackets. I use Stroustrup because unlcle Bjarne's book was the first one I read on the subject and also because I came off reading K&R while I was debating doing programming. His is a slight variation on this.

So, I guess my question is, what does Holla Forums prefer? And why? I find Stroustrup-syle more readable, because the bracket can be traced back to what is actually encompassing it instead of another bracket, and makes code more compact.

I use strousoup even though I didn't know it was called that. The reason I use it is because of readabilty and also I must admit I am partial to some nice soup. Chicken soup or even mushroom soup. Soup soup soup. Soup style is the best. Yay soup!

Moot, is that you? If so, fuck you.

Tried that and what happened?


What? That would dereference the first stream and call operator[] on it, wouldn't it?
Using [] on a pointer already dereferences it, so the syntax is the same as it would be on an array.

I did it wrong. You were actually correct. I turned in the assignment and it all worked.

AES is perfectly fine. Secure and simple. On desktop I just have aes.c and aes.h for encryption with no other dependencies. Java has AES support built in. Probably what I'm going to end up doing for the app though is Phonegap and writing some of my own native code if I can't find plugins.

Also will use a JsAES for encryption there point-at-infinity.org/jsaes/

Ah fuck nvm it's got pozzed licensing. Here's one with MIT github.com/ricmoo/aes-js

are you fucking kidding me?????????

Rolling, but this had better be quick.

XBF - eXtensible BrainFuck

Yeah, we're onto you.

im reading a book called c++ for dummies gave it a break because shit's heavy in math and calculations.

You might not be cut out for programming.

Nothing right now, I learn enough to be a little bit better than beginner tier at C++, contribute small amounts to vidya projects on jewhub and then stop for a year and forget everything I learned. I have a terrible memory and shit concentration I need to fix that so rollan for a project.

Started working my way through 'Build your own Lisp' yesterday. It's been pretty smooth sailing so far. I'm about halfway through.


I learned C from The C for dummies books, but I was in middle school then.This was also back before amazon, and the local pleb bookstores didn't carry K&R. The Hastings had both volumes of C for Dummies, so that's what I got.

Once I learned C, one of the first things I did was port a TiBasic game from my graphing calculator.

Keep at it, you'll have fun once you've learned everything.

You can get all of that (or all the important parts anyway, type inference is overrated) in other languages. Take your shittily typed overly hyped shitty syntax snake oil and get out.

such as??????????

If you need help with the "heavy calculations", post a question.

last thing i did was add a small feature to a decoder ring command line program that i developed for the sole purpose of deciphering encrypted messages in RuneScape clue scrolls.

roll

i'm not a real programmer. reroll

Today I created my first elisp function, it is simple function that takes text as input and outputs comment with that text.
Extending emacs was easier than I expected.

0x0.st/Flb.tar

Working on a TIS-100 / MOS6510 crossover thing. I'm definitely not doing it right but hopefully it works. Here's what I have so far.

By the way TIS-100 and SHENZHEN I/O are great games you guys should try em out.

Nice. I think you only understand Emacs (or any editor) once you learn to write extensions for it.

if you're still lurking, post the code user

So I was drawing simple charts from data.
Started out with Ruby because I don't really know it but it seems cool. The first few hours everything was going great, defaults all worked and looked nice. Then I realised the library I was using lacked all but the simplest of options and after hacking a few more things in I gave up.
Switched to python. Defaults are terrible. Labels run off the edge of the screen. Everything needs to be hand tweaked to look passable. In the end I was thinking I should have just written my own.

Just use perl+graphviz

I used GD::Graph before but it looks dated.
Now that I think about it I probably should've looked at javascript.

I didn't use any modules, just generate a "dot" file from your data and call it with graphviz.
Keep it simple, stupid.

I will post full code when the semester ends, or when I see that I won't be needing it.

Fuck you Jeff i need your code now before we have to turn in the assignment, post it you faggot!

You don't want to copy my code. It's shit.

since that other user is being a faglord i'll post my linked list in c++
please rate hate and subscribe to my blog

pastebin.com/raw/igjks61e

Is your print_all O(n^2)?

Sure thing but if you want to fix that just do something like:
if (!head) { return; } Node* node = head; while (node->get_next()) { std::cout get() get_next(); } std::cout get()

Updated version, someone please review it

pastebin.com/raw/tm3hSgis

...

Thank you for your constructive criticism.

store a pointer to the tail in the list that way you dont have to traverse the whole list to append.
also why isnt there a method to add something to the front?

store a pointer to the tail in the list that way you dont have to traverse the whole list to append.
also why isnt there a method to add something to the front?

fucking kill yourself codemonkey

...

What is happening???

well it is quite bad. but it is at least something

i wish that other user would post his implementation too

/prog/ is dead

I've been working on a fun C++ project to convert file to images, and even place files as random pixels in another image, which can later be extracted if you know the random seed that was used to create it.

Attached are two examples, one of a data file converted straight to an image, and the other of the of the same data file placed into another image. The idea is that any website which allows you to post png images can easily be used to share any type of file.

I'm using the Mersenne Twister 19937 generator to get platform independent random number sequences, with the seed specified by the user both at creation time and extraction time. So far I've tested it successfully on Linux and OSX.

...

I wanted to see if there was any interest before posting the code, because it's spread across several different class files, and I didn't want to spend the time uploading it somewhere if nobody cared. Pic related is the source code. If anyone is interested I'll post it as plain text too.

Ignore the spergs and upload it to github

What's a good alternative to github? Github locked me out after a student trail I had expired, and it's become a total SJW shithole.

For now I'll upload a zip to mixtape.moe. It does depend on ImageMagick because the CImg library uses that for resizing images and stuff.
my.mixtape.moe/usrukd.zip

...

Fuck, you caught me. I was testing cross operating system compatibility.

C'mon on

I actually wrote most of it a few years back, but finally just fixed one last bug. The code and comments are admittedly not great. Constructive, or destructive, criticism is welcome.

roll

The extent of my programming has been in VBScript in Libreoffice lately, just to do very basic surveying-related stuff. It's pretty crude doing it like that though, might be worth looking into SciPy or something like that.

en.wikipedia.org/wiki/Mersenne_Twister
it is actually one of the worst prng's. a complete ant total meme only popular because of c++.
literally even lcg's are better.

...

what should you do instead? public fields?

What should be used instead when you're in C++ land?

Ding Ding Ding!

pcg-random.org/

forgot to add: made by a woman
if you add that to your project, you will instantly get many diversity points

broofs?

@techreport{oneill:pcg2014, title = "PCG: A Family of Simple Fast Space-Efficient Statistically Good Algorithms for Random Number Generation", author = "Melissa E. O'Neill", institution = "Harvey Mudd College", address = "Claremont, CA", number = "HMC-CS-2014-0905", year = "2014", month = Sep, xurl = "cs.hmc.edu/tr/hmc-cs-2014-0905.pdf",}

Okay so it's a tranny, got it.

ebin
cs.hmc.edu/~oneill/index.html
youtube.com/watch?v=45Oet5qjlms

:-_DDD

Can't you just use this?
en.cppreference.com/w/cpp/numeric/random/linear_congruential_engine

sure but it will give you terrible results if not properly used.

How do you use it properly oh great number wizard?

by choosing good constants and using a good output function
pcg-random.org/download.html
a pcg is just an lcg with a permutation applied to the output

#!/usr/bin/ruby##(c) Peter Nornigdef n(nigger) Integer(nigger) rescue false enddef f(nigger) Float(nigger) rescue false enddef atom(nigger) if ((n = n(nigger)) != false) return n elsif((n = f(nigger)) != false) return n end return niggerenddef read_from_niggers(niggers) if (niggers.length == 0) then raise "unexpected EOF" end nigger = niggers.shift if ('(' == nigger) l = [] while(niggers[0] != ')') l.push(read_from_niggers(niggers)) end niggers.shift return l elsif(')' == nigger) raise "unexpected" else return atom(nigger) endenddef niggerize(ln) ln.gsub('(', ' ( ').gsub(')', ' ) ').split enddef gibs(prog) read_from_niggers(niggerize(prog)) enddef dyad(sym) lambda{|x,y| x.send(sym.to_sym, y)} enddef standard_ghetto ghetto = {} ['+','-','*','/','','='].each{ |s| ghetto[s] = dyad(s) } ghetto['='] = dyad('==') ghetto['tits'] = lambda {|x| x[0] } ghetto['ass'] = lambda {|x| x[1..-1] } ghetto['gibs'] = lambda {|x,y| [x] + y } ghetto['aintnothin?'] = lambda {|x| x == []} ghetto['hey-yo'] = lambda {|*x| x[-1]} ghetto['yaboys'] = lambda {|*x| Array(x) } ghetto['bigz'] = lambda {|x| x.length } return ghettoendclass Proced def initialize(gibsmedat, booty, ghetto) @gibsmedat = gibsmedat @booty = booty @ghetto = ghetto end def call(*args) @gibsmedat.zip(args).each{|p,a| @ghetto[p] = a} ##set args as param vals return we_wuz(@booty, @ghetto) endend$global_ghetto = standard_ghetto()def we_wuz(x, ghetto = $global_ghetto) if x.instance_of?(String) #symbol return ghetto[x] elsif(x.instance_of?(Integer) or x.instance_of?(Float)) #constant literal return x elsif(x[0] == 'if') (_, test, conseq, alt) = x exp = (if we_wuz(test, ghetto) then conseq else alt end) return we_wuz(exp, ghetto) elsif(x[0] == 'we-wuz') (_, var, exp) = x ghetto[var] = we_wuz(exp, ghetto) elsif(x[0] == 'niglet') (_, gibsmedat, booty) = x return Proced.new(gibsmedat, booty, ghetto) #ghetto scope elsif(x[0] == 'quote') (_, exp) = x return exp else pro = we_wuz(x[0], ghetto) args = x[1..-1].map{ |arg| we_wuz(arg, ghetto)} res = pro.call(*args) return res end return nilenddef niglipstr(exp) if exp.instance_of?(Array) return '(' + exp.map{|e| niglipstr(e)}.join(' ') + ')' else return exp endenddef repl(prompt='weeny say> ') while true print prompt val = we_wuz(gibs(gets)) if (val != nil) puts niglipstr(val) end endend

Thanks for the tip, maybe I'll implement tranny random numbers, or even make it user specifiable which engine to use. How much do you think poor random number generation might affect a project like this? Basically I shuffle an array of pixel indices for insertion using the PRNG and then insert data at those locations. Obviously it's not meant to be a security oriented program, but it is nice to be more secure/difficult to extract without the seed.

Fine, you autist.

List::List(){ head = NULL; current = NULL; size = 0;}void List::push(int x){ if(head == NULL){ head = new Node; head->val = x; size++; current = head; return; } current = head; while(current->next != NULL) current = current->next; current->next = new Node; current->next->val = x; size++; return;}bool List::pop(int x){ if(head->val == x && head->next != NULL){ head = head->next; size--; return 1; } if(head == NULL) return 0; current = head; while(current->next != NULL){ if(current->next->val == x){ current->next = current->next->next; size--; return 1; } else if(current->val == x){ delete current; } current = current->next; }}//print method, do not usevoid List::print(){ current = head; while(current->next != NULL){ std::cout val next; } std::cout val; current = head; return;}int List::getSize(){ return size;}bool List::exists(int x){ current = head; if(x == head->val) return 1; while(current->next != NULL){ if(x == current->val){ return 1; } current = current->next; } return 0;}

As I said, it's shit. I did it last minute and could likely re-write it better in several places. The end product ended up leaving fields as public because it was easier to work with that way, so some of the methods are unused, and I made the minimal amount of methods to get it working for the assignment. It's not a complete re-implementation of a List class found in the standard library.

What is an intended use of this list that would not be better served by a multiset?

don't do this. also don't use NULL, C++11 uses nullptr instead if you have to.

That's your complaint about this code? Something that utterly superficial?

Thanks. Didn't know that. Previously only have c experience and we always used NULL.

the code is shit from beginning to end but i don't feel like reviewing it. the null thing is easy to point out.
why don't you review it properly instead of shitposting you faggot?

I knew it was bad, but now you're just hurting my feelings.

How is it bad?

My fetid cock is slithering around near your asshole and is preparing to undertake a process which may result in the creation of the much-desired, legendary Feces Soup. Yes, it is true, my cock shall spew forth sticky goodies upon every clump of rancid, pinworm-infested feces concealed by the depths of your rectum. It will be a feces fiesta inside your ass as my tadpoles penetrate and violate every heap of feces in sight, producing the aforementioned mythical, delectable substance.

What say you?

Yeah, I'd actually like to know how specifically it's bad so I can fix it. I didn't post my code so I could try to claim non-pajeet status or brag about my sick coding skills. I know I'm not good, but I want to get better.

/myguy/

Work in progress steganography code. It encrypts, but I don't have a fucking clue how to handle images in golang to implement decrypt.
package mainimport ( "fmt" "os" "log" "flag" "image" "image/draw" "image/color" "image/png")func main(){ // defines var msg []byte var infile, outfile string var hide_flag = flag.Bool("e", false, "encode secret") var read_flag = flag.Bool("d", false, "decode secret") flag.Parse() // flag shit if (hide_flag == read_flag) || (*hide_flag && (flag.NArg() != 3)) || (*read_flag && (flag.NArg() != 2)) { fmt.Println("Usage: steg [-ed] [input] [output]") flag.PrintDefaults() return } if *hide_flag { msg = []byte(flag.Arg(0)) infile = flag.Arg(1) outfile = flag.Arg(2) } else { infile = flag.Arg(0) outfile = flag.Arg(1) } // Open source image in, err := os.Open(infile) if err != nil { log.Fatal(err) } defer func(){if err := in.Close(); err != nil {log.Fatal(err)}}() // create output image out, err := os.Create(outfile) if err != nil { log.Fatal(err) } defer func(){if err := out.Close(); err != nil {log.Fatal(err)}}() // decode m, _, err := image.Decode(in) if err != nil { log.Fatal(err) } if *hide_flag { m = hide(m, msg) if err := png.Encode(out, m); err != nil { if err := out.Close(); err != nil { log.Fatal(err) } log.Fatal(err) } } if *read_flag { read(m) }}func read(m image.Image){ bounds := m.Bounds() for y := bounds.Min.Y; y < bounds.Max.Y; y++ { for x := bounds.Min.X; x < bounds.Max.X; x++ { r, _, _, _ := m.At(x, y).RGBA() fmt.Printf("%.16b\n", r) } }} func hide(m image.Image, msg []byte) draw.Image { bounds := m.Bounds() img := image.NewRGBA(image.Rect(0, 0, bounds.Max.X, bounds.Max.Y)) i, mask := 0, 128 // encode input bytes by adjusting LSB of RGB R component for y := bounds.Min.Y; y < bounds.Max.Y; y++ { for x := bounds.Min.X; x < bounds.Max.X; x++ { r, g, b, a := m.At(x, y).RGBA() if i < len(msg) { if (int(msg[i]) & mask) != 0 { r = r | 1 } else { r = r &^ 1 } if mask != 0 { mask >>= 1 } else { mask = 128 i++ } } img.Set(x, y, color.RGBA{uint8(r), uint8(g), uint8(b), uint8(a)}) fmt.Printf("%.16b\n", uint8(r)) } } return img}

Learning openGL. Made a made a mesh class.
r8 my cube

That's a pretty sexy cube.

doing some assembly for the C64, I want to create a tape based OS, obviously I'm going to be working with the character ROM and KERNAL since that's also mostly in ROM anyways, its basically like BIOS calls in a standard PC. the OS will basically be centered around a custom cassette tape based filesystem using datasette subroutines, there will be a space in memory at the beginning of the tape for filesystem metadata so right away you can browse the system, but file access will naturally still be slow as fuck
For some fucking reason its impossible to remove the "READY" prompt without this "hack", not even the code snippets online worked for some reason
processor 6502 org $1000 ;start address lda #0 sta $d020 sta $d021 JSR $E544 sta $D3 ;move cursor to row 0 sta $D6 ;move cursor to colum 0 lda #5 sta $0286 rts

vere iz ze code Louis?

New and improved list
class List{public: List() : head(nullptr), list_length(0) {} ~List() { delete_all(); } void add(int value) { if (!head) { head = new Node(value); ++list_length; return; } Node* node = traverse(); node->set_next(new Node(value)); ++list_length; } void print_all() { if (!head) { return; } Node* node = head; while (node->get_next()) { std::cout get() get_next(); } std::cout get() set(value); } int get(int pos) { Node* node = traverse(pos); if (node) { return node->get(); } return 0; } void insert(int pos, int value) { Node* current_node = nullptr; if (pos > list_length) { pos = list_length; } if (pos get_next(); // insert new node and copy value of current node into it current_node->set_next(new Node(current_node->get())); // set the successor node of our new node current_node->get_next()->set_next(successor); current_node->set(value); ++list_length; } void delete_at(int pos) { // go to node before the one we want to delete Node* current_node = traverse(pos - 1); if (!current_node) { return; } // get successor of node we want to delete Node* successor = current_node->get_next()->get_next(); delete current_node->get_next(); // repair link current_node->set_next(successor); --list_length; } void delete_all() { if (!head) { return; } Node* node = head; while (node->get_next()) { Node* delete_this = node; node = node->get_next(); delete delete_this; } head = nullptr; list_length = 0; }private: Node* traverse(int pos = -1) { if (!head) { return nullptr; } Node* node = head; int i = 0; while (node->get_next()) { if (pos >= 0 && i == pos) { break; } ++i; node = node->get_next(); } return node; } Node* head; int list_length;};

roll

would anyone here audit some code in exchange for money?

...

I charge 5000 rupees per line.

only if it is rust code

delete all doesn't delete the last element

Already fixed, will be rolled out on patch tuesday.

Fucking frameworks, I don't want to fuck around with installing dependencies and hunting correct versions, reroll.

why???????
doesnt c++ have iterators?????
lol. rust does this automatically

play.rust-lang.org/?gist=47b9e5a7fae6774990fa8ab7a552cecc&version=stable

Is this bait?

no????? why do you ask?

roll

If you have to ask...

Honestly I bet it'd be easier if you created your own cartridge as when the cart is loaded in BASIC isn't even loaded into memory but I think the character ROM is.

Also that's some weird assembly there. Off of the top of my head you're setting the background color to black, running whatever the hell is at E544 (probably a kernal function seeing as though it's near the end of mem). Then you are moving 05 to address 0286 which is the current character color code. If that's 05 then READY. is actually still in your screen memory? (I think that starts from 0400)

I hope I'm not misunderstanding here as I don't have a datasette. Maybe you're talking about how after loading in data it says READY. but that only happens when the BASIC interpreter is loaded into memory. If you just load in the data yourself using the kernal functions you can do this without any output.

If your function takes a lot of parameters, would it be better to pass an object into it rather than all the values separately? What's the difference in terms of what's happening on the inside, is one of them more efficient than the other?
function(a, b, c, d, e, f, g, h, i, j, k, l, m){log(a, b, c, d, e, f, g, h, i, j, k, l, m);}
function(me){log(me.a, me.b, me.c, me.d, me.e, me.f, me.g, me.h, me.i, me.j, me.k, me.l, me.m);}

which language?

Rethink your design, this is not good design.

C, though I'd like to know this about other languages too.


Can't get around it.

Yeah people use structs/objects to solve this issue. But only if the arguments are related.

Your former case is special because the function can jump to or alias `log'.

If you're using a lot of these arguments and passing them down through multiple layers like this, consider passing a pointer-to-struct instead.

why does the commented code produce the correct result but the function doesn't?
[code]
function set(a,b,c,d){
if(a===b){
c = d;
console.log(a,b,c,d);
}
}

function initalA(array){
for (var i in array){
set(array[i].nationality,"Brit",array[i].house,"red");
// if (array[i].nationality === "Brit"){
// array[i].house = "red";
// }
// else if (array[i].nationality !== "Brit") {
// var index = array[i].house.indexOf("red");
// array[i].house.splice(index,1);
// console.log(array[i].house);
// }
}
}
[code]

Rolling.

Function arguments in javascript are passed by value.

thanks, i used [ ] instead of do syntax and it worked

Yeah, the array works a bit differently because the elements are stored as references. The array object argument is copied into the function parameter, but it's not a deep-copy.

Don't use "i in array" or you're going to have a bad time.

Javascript is such a steaming pile of shit.

for..of fixes the problem, but it's new enough not to be supported in some browsers.

There's many newer js features like that which make it a little nicer to use but they're all still experimental or have bad browser support.

Which results in more kludges where the code has to determine what functions in can call, ultimately no better than conditional-ridden C code.

Don't remind me. I have to do all kinds of retarded convoluted shit at work to accomplish simple tasks, just because some fucking iphone somewhere doesn't support a feature that's been supported by all major browsers for 6 years and a client complained about it. If I was the boss I'd tell them to shove their ipad or whatever up their ass, but I'm not so I just have to make it work even if I have to replace the page with an image.

rolling

rollan

So whats a good compiler. I've been experimenting with clang, aside from GNU or the shit that comes with windows, I don't know any compilers. Do they have significant differences between them for how fast your program will run? Is it just meme magic?

GCC and Clang both work fine for you. Once you're an expert, you can look into the technical differences. Until then, the most overt difference you'll notice is the licensing, but it doesn't matter so much for end users. The other difference is that Stallman is pretty weird about exporting the AST, fearing that it could be used by "nonfree" backends.

Let's rock n' roll boiz XD

Rolling.
We need new challenges though...

Alright IP obscuration here we come. I will post the finished results by October 24th 20:00 JST

If I don't ban me and call me a cuckold faggot who will be flayed and publicly displayed on the day of the rope.

...

Have you seriously done most of these? Considering the difficulty, it would take someone with significant dedication at least a year (probably way more) to do them all.

roll

github.com/yooow0t/url-obscurification/blob/master/README.md
Done. I may add tests later and do more documentation as I become more familiar with git.

Rool

Wew depressingly easy.
26th of October 01:00 JST

Better link: github.com/yooow0t/url-obscurification

Done. 9 methods of encoding but, no decoding. I fucked up and tried to make everything super generalised right from the get go instead of doing the base case and then refactoring. The whole thing is a mess.
github.com/yooow0t/message-encoder

Rolling again

Best give me a fortnight for this.
What luck, I'm reading through SICP anyway so that works out great.

did you try the challenge from the challenge thread yet?

I'm attempting to write a slackware package manager for fun but i have nobody to test it and tell me if it's still fucked because my slackware machine is fucked

The purpose was an assignment. I'm also a beginner.

No not yet but, I might

Currently scraping myanimelist for rating data to build a recommender system off of. ~4.2 million users, ~200m individual ratings. Stupid thing is at like 40GB in the db, and the damned primary key index is like 50% the size of the data itself

Currently still researching recommender systems to see how to approach though. Probably gonna be word2vec or collaborative filtering, because im particularly interested in returning nearest user in taste in the corpus.

Might try to see if I can incorporate tag based recommendation by using animedb as well

Problem is it's probably gonna take ages to go through so many records with my available compute power...

Anyone here familiar with F#? How can I generically turn this (probably invalid) JSON:

[ { filter : { subject : "foo" }, action : { assign_to : "bar" } }, { filter : { author : "foo" }, action : { status : "bar" } }]

into this (pseudocode):

match ticket with {subject="foo"} -> updateticket(assign_to="bar") {author="foo"} -> updateticket(set_status="bar")

roll

Best give me until Nov 10th. I underestimated what would need to be done. I am nearly done writing a Scheme like interpreter in Python. It isn't easy and if you rush it you fuck up.

I didn't know any compiled languages prior to this challenge and so I am now halfway through the first chapter of K&R.

If anyone is wondering the challenge was to write an interpreter in a compiled language. While I am at it I will also be getting the LISP interpreter challenge and the RPN calculator challenge out of the way bringing the total number of challenges to 5. I am aiming for 25 before January 25th and it's starting to look like I will make it. After I finish I will roll again but, I'll also be working on a Rougelike, a C compiler and C interpreter so that'll be another 2.

I hope this thread is still around by the 25th.

My appoligies for the blog post and the reddit spacing.

I'm really struggling in implementing bicubic interpolation for down scaling. I'm using the equations from paulinternet.nl/?page=bicubic.
For the x and y values that are passed in, I think it is essentially the subpixel coordinates on a region that is measured from 0 to 1 that is over the kernel.
My problem is that I keep getting garbage values and I'm too new to image processing to know what could be at fault. If my x and y values aren't set to both 0 or both 1 I get weird artifacts, see pic related. If it is set to 0 / 1 the output I get is very close if not exactly nearest neighbor. I've also tried up scaling, but I got poor results with a similar style of artifacts.

x, y are the coordinates of the new image I'm working on
px, py the coordinates on the original image that are the nearest neighbor to x and y on the new image
image holds stuff related to the original image
image->color_depth is going to be 3 since we are working in RGB
image->row_pointers[][] is the image from libpng (first indexed by the row you want, then for the row every 3 values is a new pixel, since this image is just RGB)
image->width and image->height are the width and height of the original image.
double kernel[4][4];int color[3];for (int c = 0; c < 3; c++) { for (int kx = 0; kx < 4; kx++) { for (int ky = 0; ky < 4; ky++) { kernel[kx][ky] = ((double) image->row_pointers[min(py + ky, image->height - 1)][min(px + (kx * image->color_depth), image->width * image->color_depth - image->color_depth) + c]); } } color[c] = bicubicInterpolate(kernel, 0.5, 0.5);}
So for each x and y value of my image, I build a 4x4 kernel and then run the bicubicInterpolate function on it. I do that for each of the three color channels and then I write that color to the x and y coordinates.

I'm probably doing stuff very wrong, but hopefully I am not too far off from getting it working. I'm also open to receiving more resources on how to properly implement it.

What sort of things should I develop that will impress employers? I don’t want to say “absolute minimum”, but somewhere in that ballpark would be nice.

r o l l

What do people use to compare disassembly with source code when programming in C? Particularly comparing changes when you are optimizing.
Do people just objdump or something?

I thought I'd learn programming by finding exercises online and asking Stack Exchange how to do certain things, but I have a habit I'm going to run into bad habits along the way.

Here's a program that will calculate in which year you will be 100 years old. I also happen to simultaneously be learning german.

from datetime import datedef jahrhundert(jahr): jetzt=date.today().year letzt=jetzt-jahr hundert=letzt+100 return hundert name=raw_input("Was ist dein Name?\n")jahre=input("Danke, dann wie alt bist du?\n")hundertjahr=str(jahrhundert(jahre))print "In der Jahr "+hundertjahr+", du wirst hundert Jahre alt sein."

I don't even like Python as a language for learning. It feels like advanced Excel hacking.

They don't

Hi, Holla Forums.
I have few years of experience programming things. Until now I mostly focused on learning how to compute things. Now I want to create something that would help people.
What is best way to start making GUIs?

Do they just guess what the compiler is doing?

Deutsch ist schon ne schwere Sprache hmm?

I never said that I spent much time studying it.
Mein Brüder hat drei Katzen.
Ich habe ein Apfel gefressen.
Magst du eine Hausfrau, Herr Scheisskopf?

I can write the program again in spanish if you want.

Use Qt (Pronounced cute). Documentation is great Lately been working with raw Xlib whose documentation is pretty bad.
It's pretty straight forward to use and I was able to pick it up and use it for a project easily.
Note that Qt is primarily for C++.

Thank you for replying to my message. I have some additional questions now.
Can you please tell me more about your setup for creating programs with Qt?
Is QtCreator worth learning? Should I use Qt Widgets or Qt Quick?

Ransomware which is only resolved if they hire you.

It's nothing special, just the same as any other program. They do offer their own IDE which comes with a GUI builder if that's your thing.
It's not for me, but feel free to try it out.
Use Qt Widgets. Qt Quick is similar to electron from what I've heard.

...

how does setting an envar to do something with an interperter make it unusable? Python can set like, 15 different envars id you let it.

write a script to do something as root, for users. a good example would be a script that updates an nginx config for a user's site, while checking it for 'bad stuff'.
In order for the script to run as root, but be callable by a user, you could A) have a server, like cPanel, or B) let the user directly call the script, with the script setuid: although a normal user invoked it, the script will run as root.
setuid scripts are always delicate. There used to be a race condition inherent in using a script at all. There are lots of environmental issues that need to be considered, like a malicious PATH. a serious language like Perl gives you a number of tools. Lua gives you LUA_INIT which means that any setuid lua script, ever, is a gaping security hole. Because a user can just set that variable to a script that a setuid lua script will run as root.
Of course you can fork lua.c and drop the 'feature', but I considered lua in the first place because lua was already on the farm and could just be used as-is.
$ cat hello.lua print("Hello, world!")os.exit(42)$ [email protected] luajit -e 'print("do something else")'Hello, world!

to be clear I don't need a setuid script for this. But I don't feel comfortable using Lua at all in a sysadmin context because it might encourage someone, later on, to use Lua for a setuid script. sysadmins often use technologies without being complete experts in them. Rather than require everyone to be an expert, I prefer to use technologies that tend to fail safely rather than dangerously.

If you don't like LUA_INIT, why don't you just compile a build without it?

I'm not that user, but I'd not use it for that reason, too. And I don't want to build software I can't deploy on a standard system - I'm not ok with having to tell users they need to maintain their own version of lua to not get owned while using my stuff.

The last few weekends I've been making a Holla Forums browser terminal application. Right now it's pretty basic. You hardcode the url of a thread's json into the main function and then it downloads the page and then downloads all of the images. Then it parses each image as a png, (I haven't gotten around to adding support for other image formats). Once all the data it needs has been downloaded, it prints out all the posts and images. The images are resized to be 10 lines tall using bicubic interpolation. Just over this past weekend I've added support for scrolling. You can use C-p and C-n to scroll up or scroll down through the thread. It even supports redrawing the images when leaving and enter fullscreen, along with when you switch work spaces.
It's been a great learning experience working with some of the intricacies of the terminal.

I do have a question through for you guys. When I implemented 'c' for printing out the GPLv3 license like I'm supposed to it doesn't seem to be able to print the whole thing. It's like I'm overwhelming stdout or something. Even with flushing after every single output, it does not seem to be enough and I have to add 1 second delays in order to guarantee the whole thing being printed. I even tried with half a second delay and it wasn't consistently printing out the whole thing. Do you think it might have to do with me splitting the license into 4095 characters strings?

your printing story is crazy. doesn't make any sense. try stracing the program and seeing what's up. You can do that in another terminal with 'strace -p $pid', or you can pipe stderr to a file: 'strace hatechan-browser 2>browse.log'

While cleaning up some of the spam that I was seeing in strace IIRC it's possible to be more picky with what you want to output, but I'm lazy. I figured out what was indirectly causing it.
fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL) | O_NONBLOCK);
I'm using this so that in my mainloop so that getchar() doesn't block so I can do other things like update images. I'm not too sure why this would cause that, but I'll poke around tomorrow.

This seems to actually be the direct cause of my problem.
sleep(1);//fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL) & ~O_NONBLOCK);for (int i = 0; i < sizeof(copying) / sizeof(char *); i++) { printf(copying[i]); fflush(stdout);}sleep(1);
If the line above that is currently commented is uncommented it works just fine, else it just stops part way through and the terminal refuses to print out any more of it. It's pretty weird, but I think I'll just set stdin to be blocking while it's printing it out and then set it back to nonblocking after it finishes.

Another weird thing I found out is that even though it wouldn't work if I ran it normally, if I piped in the command to print it out, the whole thing is printed out.
Perhaps it is a weird bug with (u)xterm since it only appears to happen when stdin is terminal input instead of from a pipe.

My C/C++ is a bit rusty, but shouldn't it be printf("%c", copying[i]) or printf("%s", copying) or something similar?

Honestly it should, but since my strings are constants and not based on user input they should be fine.
I'll change it anyways since it's good practice.

Not doing a programming course but I'm doing basic geodetic calcs and have been trying to rewrite parts of the spreadsheets we idiotically punch numbers into in VBScript, just because they're much more flexible as functions, and it explains what's happening. That's been partially successful but I'd rather an alternative framework like GNU Octave, and want advice on that. It has to be something I can use quickly, compiled languages are no-go.

Also just because, the bit for angle conversion. It's ugly to work with but I know my implementation could be much better and I'll probably need to write one regardless of framework as it seems uncommon.

' Main Decimal Degrees to DMSFunction DDD2DMS(B As Double) As DMS Dim X As Double Dim Enc As DMS Enc.Sign = Sgn(B) B = Abs(B) Enc.D = Int(B) X = (B - Enc.D) * 60 Enc.M = Int(X) Enc.S = (X - Enc.M) * 60 DDD2DMS = EncEnd Function' Main DMS to Decimal DegreesFunction DMS2DDD(Sign As Integer, D As Integer, M As Integer, S As Double) As Double DMS2DDD = Sign * (Abs(D) + Abs(M/60) + Abs(S/3600))End Function' Read in DMS value (format DDD.MMSSssssss)Function DMSE2DDD(B As Double) As Double Dim Enc As DMS Dim X As String Enc.Sign = Sgn(B) X = Format(Abs(B), "000.0000000000") Enc.D = Val(Left(X, 3)) Enc.M = Val(Mid(X, 5, 2)) Enc.S = Val(Mid(X, 7, 2) & "." & Right(X, 6)) DMSE2DDD = DMS2DDD(Enc.Sign, Enc.D, Enc.M, Enc.S)End Function

roll

ah fuck me

Can someone help me find a blogpost? It's satire where someone designs a ForLoop library that has semantics along the lines of ForLoop.create(); ForLoop.setInitialization(i = 0); ForLoop.setCondition(i

Best programming language to learn for cross-platform (Linux, windows, mac, maybe android too) standalone executables in the coming decade? New to programming but that would be my ideal language.

C

Is there a repo? You should make the GUI backend pluggable. I want to create a GTK+ backend for your program.

Bezier user here. I did a small GTK demonstration to test my bezier algo. r8. You can change the points[] array to any set of x,y between 0 and 1 to test it.
#include #include #include struct point { double x; double y;};int/** * Calculates factorial. (recursive) * * @param n Number to factor */fact(int n) { if (n = 1.) t = 0.0; // Draw base points BEGIN cairo_new_path(cr); cairo_set_source_rgb(cr, 1., 0., 0.); cairo_move_to(cr, (x/4)+(points[0].x*((2*x)/4)), ((3*y)/4)-(points[0].y*((2*y)/4))); for (unsigned int i = 1; i < sizeof(points) / sizeof(*points); i++) {cairo_line_to(cr, (x/4)+(points[i].x*((2*x)/4)), ((3*y)/4)-(points[i].y*((2*y)/4))); } cairo_set_line_width(cr, 3); cairo_stroke(cr); // Draw base points END // Draw curve BEGIN cairo_new_path(cr); cairo_set_source_rgb(cr, 0., 1., 1.); for (double i = 0.0; i

static gboolean/** * Handles the draw event of the GtkDrawingArea. * Just calls the main_draw method with the widget's width/height. * * @param area GtkDrawingArea widget * @param cr Cairo object passed by GTK+ * @param data Unused */main_ondraw(GtkWidget *area, cairo_t *cr, gpointer data) { (void) data; main_draw(cr, gtk_widget_get_allocated_width(area), gtk_widget_get_allocated_height(area)); return TRUE;}static gboolean/** * Queues a new draw every 1/60s. Also increases t. * t is increased here instead of main_draw so redraws outside of this don't * affect the t value. * * @param data GtkDrawingArea object as gpointer */draw_tick(gpointer data) { gtk_widget_queue_draw(GTK_WIDGET(data)); t += 0.01; return TRUE;}int/* Main function, GTK event loop. */main(int argc, char **argv) { GtkWidget *window, *darea; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); darea = gtk_drawing_area_new(); gtk_window_set_default_size(GTK_WINDOW(window), 300, 300); //gtk_window_set_resizable(GTK_WINDOW(window), FALSE); gtk_window_set_title(GTK_WINDOW(window), "Bezier"); gtk_container_add(GTK_CONTAINER(window), darea); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);n_ondraw), NULL); g_timeout_add(1000/60, (GSourceFunc) draw_tick, darea); gtk_widget_show_all(window); gtk_main(); return 0;}

2/2

Compile with:gcc bezier.c -o bezier -O3 -ffast-math -funroll-loops -ftree-vectorize -Wall -Wextra -Werror -pedantic -std=c99 `pkg-config --cflags --libs gtk+-3.0 cairo` -lm

In Shell
for i in $inputdoblah blah command $isleep 1done

Someone please show me how to replicate this simple shit in Python, Perl, Ruby or any scripting language. Without creating hordes of zombie process. Because I fucking give up.

There's no public repo at the moment. I might make a gitgud repo in the future. I might make it after finishing porting the graphics code to use ncurses instead of my own custom terminal handler I made for it.
Right now it only support xterms for images, but it probably wouldn't be that hard to port it to work in another terminal.

meep meep just use w3m's terminal image viewer tbh

It's a little to bloated for my liking. Making it myself allows me to easily cache the pixmap I am creating. w3mimacedisplay can also only open image files where mine can open images from a buffer. My images also persist when switching workspaces and back.
It's actually pretty easy to implement. The hardest part was making bicubic interpolation so that my images are always 10 lines tall.
Using w3mimgdisplay would impose several logistic problems.

Is there a language that allows you to define variables as arbitrary number of bytes, and then do whatever the fuck you want with them without it complaining that you're doing it wrong?

For example
foo[2]; //foo is 00000000 00000000foo = 1234; //foo is 00000100 11010010foo = "op"; //foo is 01101111 01110000foo = 6346335; //foo is 11010110 01011111; 1100000 was omitted from the front because there was no space for itbar[1024]; //bar is 1024 bytes longbar += 2; //bar is 10 with 1022 zeros in frontfoo = bar; //foo is 00000000 00000010bar

Fuck, actually "bar" would be 8192 zeros

Try searching for multiprecision or arbitrary precision then look
If you don't mind it not being built into the language, you could use GMP.

I'd prefer if it was part of the language so I don't have to deal with overly verbose shit from a library or send things to functions just to do basic operations.

You might be able to do something like that with unions in C.
#include #include union type{ char *info; long long inf;};int main(){ union type t; t.inf = 100000; t.info = malloc(1024); t.info = "op"; printf("%s", t.info); t.inf

No because that's not how machines work.

It is possible. What part do you not understand?
All of the things he was suggesting are possible, I just don't think a language has all of it built in.

No user that's clearly not possible.

Yes, the size of the data is limited by the amount of RAM that you have. If we assume that we are not bounded by a limited amount of RAM, our data can be as big as we want.

Ok you assume that. I'll stick with machines being finite. May the best user win.

Are you one of those turbo autists who think that when someone says "anything" it literally includes everything from growing wings out of your ass and telling the future with a cup of coffee?

I worked on the UI lib i'm doing some more. It's not compilable as a full shared lib yet but it's one .c + one .h file. Have a vid of it in action. It supports grouped and sequenced animations, and for now it supports position and opacity animations.

upon further review, I belive that void pointers and casting is your best bet

100% cancer tbh

No, because anything smaller than a byte will still be stored in a byte and everything larger than the standard datatypes is a bigint implementation.

Finished getting all my rendering stuff ported and working with ncurses. I added a small bar on the left which will eventually hold the threads you are in. Right now the whole left bar is hardcoded.
I also implemented the ability to post. It opens up emacs and you are able to type out your whole post in the comfort of an actual editor. Once you save and quit the post is posted.
I also set up key bindings so you can scroll by one line, or by a whole page.
I think next I'm going to work on getting the posting stuff actually integrated to the program. Right now it's a standalone thing. I could also work on getting it so that when new people post in a thread it will update. Another big improvement I could make is making the network requests multithreaded so I can download more than 1 image at a time. For big threads it takes a long time for it to download all the thumbnails.

Here's a video scrolling through the bottom of this thread. The flickering when scrolling by images is better in person since a blink can be faster than 33ms (1/30th of a second).

how the FUCK are you displaying images in a terminal?

Both the current display and window of the terminal of the application are passed in through environmental variables by default. I then open the display. After that, I get the child of my terminal window which is responsible for displaying text. The last thing to do is create a pixmap of the thumbnail, this includes running the image through bicubic scaling that I made. With everything set up, I can just use a regular X API to copy my pixmap onto the window.

In my event loop I listen to events that are fired when the window's size changes or workspace is switched, so I can redraw the image. When I scroll the image, I first clear the existing one, scroll the terminal, and then draw the image back.Unfortunately the scrolling doesn't seem to be instant, so I put a 0.25ms delay between the clear and the redraw.

Looks like I overestimated how long getting the multithreaded image download stuff working would take. I've never used threading stuff with C before, but it was actually really simple. I pretty much just create as many threads as images and I am using a semaphore to limit when threads can start.
For loading this thread here is some data on load times with different amount of max concurrent threads.
1: 3m 19s4: 1m 0.315s8: 35.456s16: 24.093s32: 19.610s
In the end I went with having 16 max threads. Thankfully this change makes load times for threads dramatically faster. If I wanted to make it even faster, I could draw all the text first and then download the images in the background as right now it has to download all the images before execution can continue.

Rolling

adventofcode.com/

It's XFCE, and it literally makes my life easier. I was a full tiling WM ricing autist once. Then I got a job. But I still have i3 on my laptop because the mouse is shit.
It's Compiz aka the best compositor you'll ever get on Linux.
Provide an argument.
See argument 1.
I only play TF2.
I SEETH NOT A SEMBLANCE OF ARGVMENT

Please set up a repo I'd like to take a look

stopped reading right there. stop LARPing fagg0t

I want to learn how to make android apps. Can anyone recommend a good book or tutorial series?

Android Programming: The Big Nerd Ranch Guide

Is supposed to be good. I haven't read any of it yet but it has good reviews. Also download android studio and start looking through the samples.

Thanks user.

Added two new features to my board reader. It now has autoupdate. It starts out at 10 seconds and will double every time no new posts are found until it hits a maximum time of 10 minutes. It was kind of tricky to implement because I've been running on the assumption that lines started from the bottom and not in the middle of the screen or offscreen. While I was at it, I also made it so that unicode wouldn't mess up the rendering of my text boxes. Previously, unicode characters would be treated like they took up more than 1 column so certain lines would not take up the full width.
I also implemented a posting feature upon hitting enter. Right now it only supports a comment. You can't change the name / email / subject field, nor upload images.

Since the program is pretty much at the point of being able to browse a thread and let you make text posts, I think I'll try to set up a repo for the code if anyone else wants to check it out.

Any prerequisites to this book?

Are design patterns a meme?

Depends what language you're using. If you're using Java/C#, they discuss the limitations of the language and describe constructs that allow you to solve problems within those limitations. If you're using a more powerful language, it's still worth reading, although some parts will either be completely irrelevant to the language because it's not as limited, or trivial to implement in the language.

Finished most of my Garfield tribute site.
garftse.000webhostapp.com/
Source for it: gitgud.io/fuckballs/garftse

If it's actually an important problem then simply use OpenCV. Feature extraction has been a thing for a while now tbh.

youtube.com/watch?v=P5iqYuFmzqg

Why don't you have embeds Holla Forums?

import weechat as ww.register("memearrows","user","1.0","PD","Greentext Support","","")def buf_clr(dat, mod, mod_data, msg): nck,txt=msg.split('\t') if ">" in txt[0]: return nck+'\t'+w.color('green')+txt return msgdef snd_clr(dat, mod, mod_data, msg): if ">" in msg[0]: return '\x033'+msg return msgw.hook_modifier("weechat_print","buf_clr", "")w.hook_modifier("input_text_for_buffer","snd_clr", "")
I wasn't really happy with any of the existing weechat >greentext scripts so I made my own.

It renders all >greentext messages in the buffer as green. It also sens >greentext messages with the green colorcode so everyone can see your >greentext even if they don't have the plugin.

It's python, set it to autoload in your weechat config folder if you like it

Forth. Everything is a number. Some things are pairs of numbers - like a string: it's an address with a length. Forth gets out of the way and makes it easy to work with computers as they really are.

Is that how weechat delimite nicknames from messages? It's different from the other function.

I any case, it might be a good idea to add to change it to
nck,txt=msg.split('\t',1)
Just in case somebody pastes a tab into chat, otherwise it might try to allocate it to a 3rd variable which doesn't exist and end up eating the message.

gonna get a job offer from my cousin in some weeks to design and implement a small database
im still a student and thought i would learn db in school and now that im taking it noticed the professor is a massive retard and im not learning jack shit
what are some good database books to read or tutorials or anything you can recommend?

because youtube embeds are botnet

>ForLoop.create(); ForLoop.setInitialization(i = 0); ForLoop.setCondition(i

Using SQLite: Small. Fast. Reliable. Choose Any Three.
The Manga Guide to Databases

Would anyone be interested in the code for a web extension that redirects all requests for javascript files to a local repository?
Unfortunately, you can only install it temporarily since to become permanent, mozilla needs to sign an archive of it. Since you are maintaining your own repository there wouldn't really be a way to do it (I think).
I even made a few scripts for automatically pulling down copies of javascript.
This is different from decentaleyes because you aren't limited to the small selection that they offer you. Additionally, no remote javascript files will be executed when my extension is activated.
One misleading thing about it though is if you are using it with uMatrix, you have to enable the javascript for the site you would normally be requesting from, this creates a problem if you were to load a webpage before readding the temporary web extension.

I didn't actually learn programming so I'm stuck again. I have an amount of money stored as an int in a class, and I want a portion of that money to be transferred to another int in another class. Is there a more efficient way of doing that instead of going
class_a.money-=amountclass_b.money+=amount
?
I feel that's an extremely stupid thing to do but then again I don't know how to program.

as far as efficiency goes, that's totally fine.
as far as handling money goes, what happens if the server KPs in between the -=amount and the +=amount ? You should handle money in a transactional manner.

class Point(): def __init__(self, name): self.__connections = {} self.__name = name def create_connections(self, *connections): for connection in connections: if connection not in self.__connections: self.__connections[connection.name] = connection connection.connections[self.name] = self def show_connections(self): return list(self.connections.keys()) @property def connections(self): return self.__connections @property def name(self): return self.__name if __name__ == "__main__": from queue import Queue print("Running") Point_A = Point("A") Point_B = Point("B") Point_C = Point("C") Point_D = Point("D") Point_E = Point("E") Point_F = Point("F") Point_G = Point("G") Point_A.create_connections(Point_B, Point_C) Point_D.create_connections(Point_C, Point_F) Point_E.create_connections(Point_B, Point_G) Point_G.create_connections(Point_F) print("Point A", Point_A.show_connections()) print("Point B", Point_B.show_connections()) print("Point C", Point_C.show_connections()) print("Point D", Point_D.show_connections()) print("Point E", Point_E.show_connections()) frontier = Queue() frontier.put(Point_A) came_from = {} came_from[Point_A] = None while not frontier.empty(): current = frontier.get() for next in current.connections.values(): if next not in came_from: frontier.put(next) came_from[next] = current current = Point_F path = [] while current != Point_A: path.append(current.name) current = came_from[current] path.append(Point_A.name) path.reverse() print(path)

I was simply wondering if there was a better way to write this code, specially the way i handled the objects names. I believe there is nothing wrong with the pathfinding, mostly because i copied it from redblobgames.com/pathfinding/a-star/introduction.html

Im working on a program tjat simulates a solar system. The only problem is is that I cant figure out how to simulate the flow of time without a massive for loop.

Set up a repeating timer and update your world with delta time = interval between the two last ticks. Or if it's a graphical program, you could do the updates in the frame loop.

Is it possible to get a programming job with just a 2 year degree or am I just wasting my time applying for jobs?

i-i made a shitty image board with lynxchan

badplanchan.net

pls don't b-bully

I am not going to fill out a captcha for every single fucking post.

Aaaaaaand into the garbage it goes. Holla Forums allows Tor posting without images. Mewch, Endchan, and a number of other minor chans allow Tor posting with images. There's really no excuse for an altchan not to allow Tor.

I like the name.

Finished my lemonbar script (really have nothing to touch, now). Made me learn some awk; pretty nice language.

#!/bin/sh# Dependencies: procps, iproute2, cmus, bar_fifo.sh, lemonbar, xdo# Portability: Linux (/proc/stat)set -ubar_fifo=/tmp/bar.fifonetif=enp3s0mountpoint=~/Data# Must support the `-e` optionterm="st -c floating"[ -e "$bar_fifo" ] && rm -- "$bar_fifo"mkfifo "$bar_fifo"trap 'trap - TERM; kill 0' INT TERM HUP QUIT EXIT# bspwm workspaces statusbspc subscribe report >"$bar_fifo" &# Clockwhile truedo printf 'c%s\n' "$(date '+%a %b %d %T')" sleep 1done >"$bar_fifo" &# Battery capacity# while true# do# awk -F= \# '/CAPACITY=/ { cap=$2 }# /STATUS=/ { status=$2 }# END { printf "bbat: %02u%% (%s)\n", cap, status }' \# /sys/class/power_supply/BAT0/uevent# sleep 3# done >"$bar_fifo" &# Avail / total memawk -v delay=3 -v red='%{F#aa0000}' ' BEGIN\ { while(1) { "free" | getline "free" | getline close("free") printf "m%s%.1fG / %.1fG\n", ($7 / $2 < 0.25) ? red : "", $7 / 2^20, $2 / 2^20 system("sleep " delay); } }' >"$bar_fifo" &# Avail / total diskawk -v delay=15 -v red='%{F#aa0000}' -v mountpoint=$mountpoint ' BEGIN\ { cmd="df " mountpoint while(1) { cmd | getline cmd | getline close(cmd) printf "d%s%dG / %dG\n", ($4 / $2 < 0.1) ? red : "", $4 / 2^20, $2 / 2^20 system("sleep " delay); } }' >"$bar_fifo" &# Cpu usage %awk -v delay=2 -v red='%{F#aa0000}' ' function stat_read() { getline < "/proc/stat" close("/proc/stat") } BEGIN\ { stat_read() while(1) { system("sleep " delay) split($0, old) stat_read() usersys=$2 - old[2] + ($4 - old[4]) usage=usersys * 100 / (usersys + $5 - old[5]) printf "p%s%02u%%\n", (usage > 90) ? red : "", usage } }' >"$bar_fifo" &# IP addresswhile truedo printf 'i%s\n' "$(ip a show "$netif" | \ awk '/inet / {gsub(/\/[0-9]+/, "", $2); print $2}')" sleep 15done >"$bar_fifo" &# Cmuswhile truedo if ! pgrep -x cmus >/dev/null then printf 'M%s\n' '%{F#aa0000}cmus isn'\''t running' else cmus-remote -Q | awk -v term="$term" ' function value(line) { sub($1 FS $2 FS,"") return $0 } /^status/\ { sub($1 FS,"") status=$0 if(status == "stopped") exit } /^tag (album|artist|title|date|tracknumber) /{val[$2]=value($0)} END\ { if(status == "stopped") printf "M%%{F#aa0000}stopped%\n" else { printf "M%s\n", \ (status == "paused" ? "%{F#aaaa00}" : "") \ "%{A:cmus-remote -C \"seek 0\":}%{R}|" : "||") "%{R}%{A} " \ "%{A:cmus-remote -C \"player-next\":}%{R}>|%{R}%{A} " \ "%{A:" term " -e tmux a -t cmus 2>/dev/null:}" \ val["artist"] " - " \ (val["date"] != "" ? "(" val["date"] ") " : " ") \ val["album"] " - " \ val["tracknumber"] ". " \ val["title"] \ "%{A}" } }' fi sleep 2done >"$bar_fifo" &~/.config/lemonbar/bar_fifo.sh

needs SSL

Guess I'll post mine
#!/bin/bashpanel="$(getxresource deskenv panelHeight)"underline_width="$(getxresource deskenv underlineWidth)"font1="$(getxresource deskenv font)"font2="$(getxresource deskenv fontFallback)"fg="$(getxresource deskenv foregroundColor)"bg="$(getxresource deskenv backgroundColor)"active="$(getxresource deskenv activeColor)"inactive="$(getxresource deskenv inactiveColor)"underline="$(getxresource deskenv underlineColor)"# function desktop {# function desktop_loop {# desk+="%{B${inactive}}"# for workspace in $(seq "$@"); do# desk+=" "# done# desk+="%{B-}"# }# local -a current_arr=($(xprop -root _NET_CURRENT_DESKTOP))# local -a total_arr=($(xprop -root _NET_NUMBER_OF_DESKTOPS))# local -i current="${current_arr[-1]}"# local -i total="${total_arr[-1]}"# local desk=""# desktop_loop "$current"# desk+="%{B${active}} %{B-}"# desktop_loop "$((current + 2))" "$total"# printf '%s' "$desk"# }function desktop { function desktop_cond { if bspc query -D -d "$desktop".focused.local &>/dev/null; then desk+="%{B${active}} $name %{B${inactive}}" elif bspc query -D -d "$desktop".urgent &>/dev/null; then desk+="%{R} $name %{R}" else desk+=" $name " fi } desk="%{B${inactive}}" for desktop in $(bspc query -D); do name="$(bspc query -D -d "$desktop" --names)" if bspc query -D -d "$desktop".occupied &>/dev/null; then desk+="%{+u}" desktop_cond desk+="%{-u}" else desktop_cond fi done desk+="%{B-}" printf '%s' "$desk"}function title { declare -a active_win=($(xprop -root _NET_ACTIVE_WINDOW)) declare -a wm_name=($(xprop -id "${active_win[-1]}" WM_NAME 2>/dev/null)) if [[ -n ${wm_name[2]} ]]; then name="${wm_name[@]:2}" name="${name:1:-1}" if (( ${#name} > 56 )); then printf '%s...' "${name:0:56}" else printf '%s' "$name" fi fi}function clock { date '+%a %d/%m/%Y %H:%M'}function volume { local -a master=($(amixer get Master)) local -A suffix=(["[on]"]="%%" ["[off]"]="M") local level="${master[-3]:1:-2}" local status="${master[-1]}" printf '%s%s' "$level" "${suffix[$status]}"}function res { local -a perc=($(ps -eo "p${1}")) perc[0]="0.0" IFS="+" sum="$(printf '%s\n' "${perc[*]}" | bc)" printf '%s%%%%' "${sum%%.*}"}function disk { local -a d=($(df --output='pcent' "$1")) printf '%s%%' "${d[1]}"}function network { local -a route=($(ip route)) gateway="${route[2]}" if [[ -n $gateway ]]; then if ping -c 1 "$gateway" &>/dev/null; then printf 'UP' else printf 'DOWN' fi fi}declare -a head=("%{l}" "%{r}%{B${inactive}} ")declare -a sep=( " > " "%{F${active}} | %{F-}")declare -a tail=("" " %{B-}")declare -a content=("%s;desktop;;0%s;title;;0""NET:%4s;network;;3000ROOT:%5s;disk;/;100HOME:%5s;disk;/home;100DATA:%5s:%5s:%5s;disk;/mnt/data0 /mnt/data1 /mnt/data2;100CPU:%5s;res;cpu;10MEM:%5s;res;mem;10VOL:%5s;volume;;0CLK: %s;clock;;100")declare -A bufferdeclare -i tick=0declare -i tick_lcm=3000 # precalculated from 'delay' in 'content'while :; do for ((i=0; i < ${#content[@]}; i++)); do c="${content[$i]}" buffer["$i,0"]="${head[$i]}" declare -i j=0 while IFS=";" read -r fmt func args delay; do if [[ $delay = 0 || $((tick % delay)) = 0 ]]; then if [[ -z $args ]]; then fmt_args=("$("$func")") else fmt_args=() for arg in $args; do fmt_args+=("$("$func" "$arg")") done fi out="$(printf "$fmt" "${fmt_args[@]}")" buffer["$i,$((j * 2 + 1))"]="$out" if ((j)); then if [[ -n $out ]]; then buffer["$i,$((j * 2))"]="${sep[$i]}" else buffer["$i,$((j * 2))"]="" fi fi fi ((j++)) done

Roll, give me something good.

I don't know shit about emulation, but it looks like the TI-86 has a 80 cpu so I'll ry emulating that first.

I'm new to python and wanna know a good graphics library that has a distance function and the ability you can make shapes with individual points

rollen

...

time to learn C fucker

Hey faggots whats a good book for continuing learning C# at an intermediate level? So far all the books I've come across assume you don't know fuck all about C# or programming, so 95% of the stuff in it I already know.

C# For Offshore Programmers by Pajeet Curryshit

Not too familiar, but I guess it's as good a web framework as any
Very common. I recommend React
I wouldn't bother with Firebase, you have to learn their tools and when you have, you are stuck with an expensive system owned by someone else. In that time you could have built your own backend.
Never used it but if you want to do web dev or apps, I guess you can skip this?

Lol, C is not different from other programming, it's just more confusing at first cause of pointers.

Been doing Project Euler in Forth. New to Forth, I reckon there's a lot of optimisations I could make here. Computes prime factors:
: factors ( a -- f1 ... fn ) 2 begin 2dup /mod swap 0= \ if cr . dup . swap .s recurse if swap . recurse \ if swap recurse else drop then 2dup > if 1+ 0 else 1 then until ;

Ignore lines prefixed with '\', those were commented test lines.

cryptocurrency infos
discord gg/CFP44ZC