[ / / / / / / / / / / / / / ] [ dir / cyber / d / imouto / ita / miku / nofap / s / tulpa ]

# /tech/ - Technology

Name Email Select/drop/paste files here (Randomized for file and post deletion; you may also set your own.) * = required field [▶ Show post options & limits]Confused? See the FAQ.
Flag None2XOS9frontAbsolute LinuxAlpine LinuxALT LinuxAmigaAndroidAndroid-x86AntergosantiXApartheid LinuxAPODIOAppleApple (Classic)ArchBangArch LinuxArtistXAsteriskNOWAtariAzure Cloud SwitchBlackberry OSBodhi LinuxCentOSChakraChrome OSChromium OSClonezillaCloverOSCommodoreCrunchBangCRUXDebianDOSDragonFly BSDDreamlinuxEdubuntuelementary OSEliveEmacsEvolve OSFedoraFirefox OSForesight LinuxFreeBSDFreeNASFrugalware LinuxFuduntuFuntooGeeXboXGentooGhostBSDgNewSenseGNUGNU/LinuxGNU HurdGuixGuixSDHaikuIBMIllumosKali LinuxKnoppixKororaKubuntuLinuxLinux MintLubuntuMageiaMandrivaManjaro LinuxMEPISMINIXMooOSMorphOSMythbuntuNetBSDNexentaStorNimbleXNuBSDOLPC OSOpenBSDopenSUSEParabola GNU/Linux-librePardus LinuxPC-BSDPCLinuxOSPinguy OSPlan 9 from Bell LabsPuppy LinuxReactOSRed HatSabayonSailfishSalix OSScientific LinuxSlackwareSlaxSliTaz GNU/LinuxSolarisSymbianTailsTempleOSTiny Core LinuxTizenToleranUXTrisquelUbuntuUbuntu GNOMEUbuntu MATEUbuntu StudioUltimate EditionUtutoVectorLinuxViperrVoid LinuxWindowsWindows (Classic)Windows 7Windows VistaWindows XPXubuntuZenwalkZorin OS Show oekaki applet (replaces files and can be used instead) Do not bump(you can also write sage in the email field)Spoiler images(this replaces the thumbnails of your images with question marks) Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdfMax filesize is 16 MB.Max image dimensions are 15000 x 15000. You may upload 3 per post.

File: a6de6db1ecae76b⋯.png (1.19 MB, 3840x2160, 16:9, programming_challenges_v4.….png)

No.863611

Working on code? Post it here!

Not working on code? Open your sh-compatible shell and type echo $(( ( RANDOM % 145 ) + 1 )) to choose a challenge. If you have any more of these programming challenges images, please do share. NO BLOAT NO OBSFUCATION NO GAY SHIT No.863787 /tech/ only cares about browsers No.863793 >Open your sh-compatible shell and type echo$(( ( RANDOM % 145 ) + 1 ))

$RANDOM is not POSIX sh, it's a bash extension. Shit op, shit thread. No.863798 >>863793 /thread No.863799 Thread Sabotaged. No.863801 Fucking fa/g/s No.863802 >>863793 Well shit No.863805 File: d5f7954aa7bac09⋯.png (248.33 KB, 1224x918, 4:3, ClipboardImage.png) >>863801 :--------DDDDDDDDDDDDDD No.863807 >>863787 Don't forget expensive hardware solutions designed for problems they don't have. >Muh SSD controller isn't LIBREEEEE, I cannot work with this!!!! No.863808 File: dcc4ba00d512b64⋯.jpg (139.18 KB, 782x366, 391:183, tech.jpg) >>863611 >"pro/g/ramming challenge" >no gay shit right No.863812 >>863793 >$RANDOM

tr -cd 0-9 </dev/urandom | head -c 3

No.863817

>>863812

>/dev/urandom

Not POSIX

No.863820

>>863817

What the fuck is POSIX even useful for if it doesn't have the most basic shit

No.863825

Made a bash script that takes a list of handles, gets all of their tweets, sorts it by date, and converts it all to a neat XML that doesn't make newsbeuter shit its pants. Was pretty difficult debugging because I didn't know about "set -x" until I was already done (and that I've never used bash). Took me about three days of non-stop (NEET) programming (figuring out REGEX and the clusterfuck of sed/awk/grep/egrep/gawk/gsub) to finally get something I'm proud of. Got a spiffy mandoc and some options. About 350-400 lines if you remove the mandoc and newlines. Was a pretty good experience.

/blog

No.863827

>>863820

seed=$(date +%H%M%S)i=1modulus=$((2<<32))a=1664525c=1013904223while [ $i -lt 1000 ]; do seed=$((((a * seed) + c) % modulus))    i=$((i+1))doneecho$(((seed % 145) + 1))

I'm on my phone, so I didn't check my code thoroughly, but this should be POSIX. Note that date +%s is not POSIX.

No.863831

Any accidental entropy-destroying flaws that cripple the random number generator and make it unsuitable for real world use were inserted in the spirit of unix by the way

No.863835

>>863827

Why use something so bloated? Try this one-liner that I discussed in my blog[0]:

head -10 /dev/urandom | cksum | cut -f1 -d " "

-----------------------------------------------------------------------------------------------------------

Serenity is happiness and my happiness is a bacon and egg sandwhich in the morning!

No.863836

>>863835

This answer answered my original question pretty well. BUT, command prompt tells me head or cksum or whatever cut is don't exist???

No.863837

>>863836

Why is this in the unix forum?

No.863839

>>863836

>command prompt

Install Gentoo.

No.863840

@863836

Moved to pozzers.united.anonymous.stackexchange.com/peepee-hurt%21

Thank you and remember not to necro bump or make duplicates

______________

Lebronious the Master Programmer

For the new guys who know, sometimes you just need a hand.

Blog | Skype | Myspace | Discord | AOL

IF YOU CAN'T HANDLE THE HEAT, STAY OUT OF THE CODE SESSION!!!

No.863843

>>863839

:below_the_waist_ok_hand:

The game

No.863846

>>863843

No.863865

>>863835

/dev/urandom is not POSIX. head -10 (as opposed to head -n 10) is not POSIX. cut -f1 (as opposed to cut -f 1) is not POSIX.

And you're taking the first ten lines of random noise, which means you wait until there've been ten newlines, which is arbitrary and pointless and hard to reason about.

Consider me triggered.

No.863866

File: 672d353f499d791⋯.jpg (93.94 KB, 194x444, 97:222, martians_just_worse-us-198….jpg)

No.864059

>>863611

Am doing bullet hell engine (120) in sfml, will post code when finished

No.864170

>>864059

Interesting one. I have given it a bit of thought but I'm not motivated for any kind of game programming.

I have done the ones about music synthesis and MIDI, they are my cup of tea. Now I implement some audio effects out of the dafx book.

No.864227

>THIS ISN'T POSIX

>REEEEEEEEEEEEEEEE

lmao. stop using trash. use fish. it is the best shell

btw, /tech/ can't program. also all those challenges are shit

No.864336

File: 5b38181c4123541⋯.png (270.6 KB, 812x798, 58:57, 1448303957242-0-v.png)

I'm making a web server to expand my language knowledge with shit that I don't use at work every day but I'm still fucking around with server tutorials in both Go and Python and haven't decided which one I should use for the full blown actual thing. They both have a lot of disgusting aspects, but Go has the slight edge for not being some retarded whitespace language. Python would be more professionally useful for me to know but it just feels so degenerate to not have brackets. Also the 2.7/3.3 split is a little asinine.

No.864340

>>864336

> 2.7/3.3 split

Python 2 is being phased out left and right, from Operating Systems to I forget.

Official End of Life of Python 2 is 2020.

Just start coding in Python, by which is now almost universally meant Python 3, and don't worry about the rest.

Forcing people to indent so that their code doesn't look like PHP coders' spaghetti is not retarded.

No.864342

>>864340

And yet 2.7 is still critical to just about every Linux distro out there.

No.864344

>>864336

Python 3.3 is grossly outdated. I don't think it's supported any more. The current release is 3.6.

Python 3 is a better language than Python 2 in a lot of ways, some of them backward incompatible. The split is asinine, but having to deal with Python 2's bad decisions even more so. Go has vague plans to do a similar incompatible new version at some point.

Brackets don't matter. I think whitespace is a bit better but it's one of the least important aspects of the language. The reason people argue about brackets is that you don't have to know anything about the language to do so. It's bikeshed bait.

Python is a bit more useful than Go in general. It's very versatile. Comparing them isn't very sensible, though, they occupy different niches.

>>864342

If I uninstalled it right now it would only remove libraries and a few applications, no system parts. I'm running Debian.

It's still used because upgrading takes effort. It's a bad idea for nearly all new code.

No.864346

>>864344

>The reason people argue about brackets is that you don't have to know anything about the language to do so.

I feel like the only people who actually believe this are the ones who use whitespace languages.

No.864348

>>864346

I write code in whitespace languages, bracket languages and ALGOL-style languages, among others, and I haven't found a reason to strongly care. All text editors I use are intelligent enough to make it nearly irrelevant.

No.864515

>>864348

>he doesn't program with echo

No.864573

>>863820

>What the fuck is POSIX even useful for if it doesn't have the most basic shit

POSIX is UNIX weenies with political power. They get to force their "standard" onto vendors and users.

Heard in a talk by a vendor at a conference I was atrecently...  The unix market has generally been more forgiving    on quality aspects.''Gee, I always thought of the distinctive Unix level ofquality as unambiguously negative.  But seen from the otherside, it has its advantage.  First beat your customers intoa daze where they don't know good from bad, then lean backand enjoy the cash flow from putting out products that meetestablished expectations... Why didn't I think of that?

       it *was* nice of British Telecom to force Sun to   rename their white pages service to be something other   than "yp") ...A crying shame too.  After all, even though Sun's "yellowpages" service was really a white pages (name lookup)service, they should have been able to use whateverdeceptive name they wanted.  Renaming things for marketposition is really a modern (not just unix) tradition:Build a presentation manager: call it Presentation Manager...Build a personal computer: call it The ibm Personal Computer...Build a machine with an 8-bit byte: Define "byte" to be 8 bits...Build a IO subroutine package: call it DOS (an OS).But the unix weenies have refined it to a high art.Everything must be "open" and a "standard."  Why, my companyalready supports at least a dozen "standards!"The latest Sun entry is their new "free" window system.Their salesman called me proudly: all you need to do is sendthem a thousand dollars a copy, plus pay a royalty onprograms which use it, and you can use their new free openstandard window system (called "open look" of course).Hm, maybe I can add cons to C and call the result Lisp...

No.864592

>>864515

All the cool kids use printf(1). The echo(1) specification is full of implementation-defined behavior.

No.864812

>>863611

I was writing a ZilogZ80 cpu emulator, need to get back to work on it though.

No.864823

>>864812

post it on /byte/ when you're done

>>>/byte/

No.864824

>>864823

It'll probably be shit because I've never wrote an emulator before, but sure I'll post it.

No.864825

>>864823

Not taking the piss, how is this different from prog?

No.864827

>>864825

No.864828

>>864827

Not much different from your board, eh? It gets close to 20 posts monthly.

No.864829

>>864828

When I have time I plan to flood my board with a deluge of manufactured posts and perhaps a low-frequency bot

No.864831

>>864829

Aight, I'll lurk and contribute where I can.

No.864835

>>864829

If you want to get people to use your board you're going to need to build and foster the community. That is, hold community events and do small things to encourage participation like a tan-design or banner submissions or something. You could also do something like /pol/ does and sticky important threads for awhile to get participation on big issues and such. Also consider ID's to curb the lowest-tier shitposters. Good luck with the board anon.

No.864847

First semester of C++, my classes are pretty horrible and mostly consist of me working through sicp while listening to business majors talk about twitch and complain about how hard C++ is. I think I'm going to rewrite a podcatcher I wrote awhile back to handle youtube RSS feeds and use the curl library if I can figure it out. This is my first reasonable C++ program.

/* Adds a list of fractions and outputs the simplified fraction. */#include <iostream>#include <cmath> using namespace std;int main() {/* * Define variables for the number for the iterator, the input, the numerator, * the denominator, and the denominator and numerator from the last iteration. */ 	int i = 1;	int input;	double old_den = 1;	double old_num;	double numerator;	double denominator = 1;         cout << "Type each int pressing Enter at the end of each." << "\n";	cout << "Type done when done." << "\n";/* * For every integer typed determine if the iteration is even, if it is equate * the input to old_num and then add the fraction to the numerator to be  * multiplied by the entire common denominator later. If the iteration is odd * multiple the input by the total denominator to form a common denominator and * equate the input to old_den for use in the next iteration. */         while (cin >> input) {                if (i % 2) {                        numerator = (old_num / old_den) + numerator;                        old_num = input;		} else {                        denominator = denominator * input;                        old_den = input;                }                ++i;        }/* Make up for the last iteration and multiply by the common denominator */	numerator = ((old_num /  old_den) + numerator) * denominator;	if (denominator == numerator) {		cout << 1 << "\n";		return 0;	}	if (numerator == 0) {		cout << 0 << "\n";		return 0;	}/* * Reuse the iterator to countdown from the square root of the larger part of * the fraction to find the greatest common divisor. */ 	if (denominator > numerator) {		i = sqrt(denominator);	} else {		i = sqrt(numerator);	}/* Must be changed to int because you cant calculate the remainder of a float */	while ((int)numerator % i || (int)denominator % i) {		--i;	}        cout << numerator / i << "/" << denominator / i << " | ";	cout << numerator / denominator << "\n";        return 0;}

No.864886

>>864847

Not a one line comment, not a two line comment, not even a three line comment, but a FIVE LINE comment. On a scale of "uses orthogonal in casual conversation" to "requires all assignments be turned in, in manually optimized binaries," how pedantic is your professor?

No.864892

>>864847

The best thing to do with C++ is use C-style syntax and C libraries.

No.864904

>>864886

He's not bad tbh. I think it's mostly because it's the beginning of the course and he wants to make sure we understand what we're doing, although I'm not sure how we wouldn't considering he mostly just gives us a problem and tells us to figure it out.

>>864892

My thoughts exactly, this really bugs my prof though :P

I need to switch to cstdio, or I guess stdio.h to complete it then it should run in a c compiler I think.

No.864925

>>864847

>fraction simplifier

>you enter numbers and don't actually enter fractions

you're a fucking retard

No.864966

>>864925

C only handles full and floating point numbers fucking retard

No.864985

>>864966

The entire point of programming is to make computers do things they didn't do before. It's absolutely possible to handle fractions in C. And that program isn't even written in C.

Honestly, I'm not sure what you're trying to say.

No.865004

>>864966

This is nothing in the entire world to do with int or float. It has to do with your interface not being smart enough to accept a string "5/10" and parse out the 5 and the 10 instead of having the user type each one individually.

And then you have the user fucking type "done" to finish what the hell.

No.865028

>>864812

Aren't Game Boy emulators exactly that?

No.865031

>>864925

it adds fractions and simpilifies, I'd like to be able to enter fractions, but I don't know how to do that yet. read first semester c++

No.865185

>>865028

Pretty close. The Gameboy has a Z80/intel8080 hybrid sort of CPU.

No.865299

>>864847

After you add your fractions, you should use a normalization routine to put them in a canonical form. Hint: Use the GCD algorithm, both the recursive and imperative versions are dead simple to write, and it'll save you from that abomination at the bottom of your code.

No.865355

>>865299

I'm confused what you mean, isn't that what I did?

>use gcd to simplify (not efficiently but still)

>output in canonical form

No.865429

I wrote a hexdumper in Retro Forth, going to work it further later. I posted it at >>>/byte/8, you should check it out if you like concatenative languages, they're quite like functional languages but (I would reckon) more readable and more practical. look at Joy as an example.

No.865435

>>865429

>Retro Forth

result of guy spotting a horse in the distance and saying, huh, that's a good idea. Then that guy goes off, with no further experience or knowledge of horses than this one glimpse, to invent the Ride-able Gimp(TM)

if you want a somewhat practical Forth-like language, at least go with Oforth: http://www.oforth.com/

The real thing is also available, and not that bad. My interest only waned when I found ATS - comparatively terrifyingly complex, but complexity wasn't my concern. My concern was always that the shittiness that most programmers deal with is actually non-beneficial. Languages like Python or Java only even exist because programming hasn't developed as a discipline enough to have good tools. Even when someone develops a straight metal hand-axe there are these apes who are completely sure that their bunches of twigs remain competitive.

>Joy

a language whose total worth is summarized as: "I got people to pretend that 'concatenative' is some kind of special, meaningful category of programming language."

No.865439

>>865435

Retro is quite cool, it has the colours of colorForth implemented as prefixes and even conditionals are postfix. All implemented on a tiny MISC vm. Look at the docs, it's great.

WHy would I use Oforth over regular Forth (gforth or pforth or SwiftForth)

No.865440

>>865435

No.865441

>>865004

of course a real program would accept a single argument which is the URL of the JSON object that it should decode to get its input.

No.865443

>>865440

nah that stench is "pent up with incomplete rants". Really the short story is just that I really hate Haskell.

>>865439

Oforth has literal arrays and hash tables, and it offers explicit parameter passing in a language that is still otherwise very Forth-like. The arrays and hash tables you could graft on to Forth proper, but the parameterization you realy need another language for. This sounds like a small thing but Forth code tends to look like A B C D E F G where some of those words consume inputs and some of them emit outputs and you have to sit and study the code to reconstruct simple data flow. It's not for nothing that any Forth programmer you talk to will agree that some other Forth programmer's code is shit: any style variance interferes with how Forth programmers learn to intuit their own data flow. There's a lot of cool things about Forth but this is simply a burden and with Oforth you can avoid it.

No.865459

>>865435

How is the American Thoracic Society compare to C?

No.865468

All I want is a concurrent array-oriented meta semi-functional language with mutability, lazy evaluation, strong static flow sensitive type inference, and some sort of safe compile time memory management.

Why doesn't it exist.

No.865505

>>865459

Come up with all the reasons to use C.

<I want to work with existing C libraries.

<I want people to be able to work with my code using C.

<I want to hack on some C project.

<I want the speed, the separate compilation, the minimal overhead, and I want to ship a binary.

<I want to be able to use low level interfaces and cool system shit like rename2 and unlinkat and clone and ptrace and getdirents-having-filename-type-information that 'modern languages' don't expose at all

OK all of those reasons apply to ATS. ATS's ability to integrate with C is beyond compare--even C++ is massively worse as a drop-in enhancement to a C project.

No this is not just a function of ATS being able to compile to C. Nim does that. Lots of languages do that or have easy to use foreign function interfaces. You can get 'cool system shit' in Perl and Ruby and such even, with tools that go so far as to generate the interface/wrapping code for you. ATS wins utterly against all of that.

Meanwhile, ATS has ML-style pattern matching and datatypes, dependent types (compile-time error if you try to pass something that could possibly be NULL to this function), linear types (compile-time error if you forget to close a file that you opened). You can use C-style pointer arithmetic on arrays in ATS, have it be exactly as efficient as well-written in C, and have it throw a compile-time error if any sonofabitch (you) edits it later in a way that could possibly result in an out-of-bounds dereference or write.

Oh and also you can dial that stuff all all the way down to zero, or all the way up to 11.

Only downside: this stuff is hard to learn. Even other languages with similar-sounding capabilities don't do them like ATS does. You might get to re-experience what it felt like to learn how to program for the first time. When I first learned C I wrote 150+ tiny programs in a directory, called 1.c, 2.c. I never did that again until now.

No.865555

>>863805

>PHP

got it.

No.865933

What happened to the prog fags? Board is dead. Only chan I know of that has a somewhat active board is lain. Is that it?

No.867759

File: fa4059d217cba28⋯.jpg (128.06 KB, 1169x750, 1169:750, 1517706187441.jpg)

sup guys. NOOB here, I need YOUR help.

I am not new to programming, I programmed back in high school with c# and made little programs. I stopped for 2 years and now I want to get back to it, so I can prepare myself to enter a computer science degree in university. (right now i'm doing biology, and no, I don't want to do bio informatics)

Where should I go to learn? SICP looks pretty fucking old and heavy to me, is it really the only way or is it only a neckbeard meme?

No.867770

>>865933

post on >>>/byte/ and bring the legend back to life.

No.868061

>>867759

If you already know some c# learn c#, simple as that.

Sicp is a amazing book, but it's only helpful in its ability to make you learn some language other than scheme better.

Also for future reference, don't derail a thread with hardware/software questions. put that shit here >>733048

No.872835

bump

No.872854

>>872835

>>872844

thats 20 threads in 2 hours, no new content added to a single one, can someone please ban this nigger?

No.872859

>>872854

No.872867

>>872859

>>872835

behold: top kek

nobodys posting anything in this thread

they havnt been for over a week

No.872886

>>872867

That's not an excuse to streetshit here.

No.872896

>>872886

>his post with no content at all is fine but your post making a note of that is not because it contains no code

gonna guess that youre probably him because nobody can be that unironically stupid

No.872921

>>872896

Filtered.

No.873515

>hello world

>1.8mb

what did Go mean by this?

No.874666

File: 338db575655644b⋯.mp4 (580.02 KB, 854x480, 427:240, know your fucking place.mp4)

>>873515

>do hello world example in Go

>type in my header and imports

>make the main function

>Ctrl+S because I always fucking save stuff I'm working on constantly

>all of my imports are fucking gone

>gofmt forcibly deletes and refactors your shit on save

>imports got nuked because they were unused at the time of saving

>mfw uninstalling everything related to Go

No.874744

>>874666

Go is extremely bizarre. I'm really not sure if it's a troll. The error on unused import and variables followed by producing a giant binary has to be a joke. The constant forced error handling is clearly a joke about C programmers never checking return values.

Interfaces are some weird OOP jab. Like the difference is instead of doing foo(object, val) you do (object) foo(val). That's like a zero cost abstractions joke.

No.875034

>>874744

I think the reason it feels so bizarre is because we're not the kinds of people it was created for. It was created for the kind of mouthbreathers that don't actually read the directions or attempt to understand what they're writing and just start copypasting shit into their code from stackoverflow. What the hell is "fmt"? Who cares, it'll automatically get imported when I save the file anyways. Code is spaghetti trash with orphaned crap lying around everywhere? Don't worry, just save it and it'll all be cleaned up!

No.875067

>>863611

45 - RPN Calculator - Common Lisp

(defun rpn-calculator (list &optional operand-stack)  (cond ((null list) (car operand-stack))	((numberp (car list)) (rpn-calculator (cdr list) (cons (car list) operand-stack)))	(T (rpn-calculator (cdr list)		 (cons (reduce (symbol-function (car list))			       (reverse (list (pop operand-stack)					      (pop operand-stack))))		       operand-stack)))))

ez

No.875084

96 - Generate a complimentary color from any input color - Common Lisp

(defun main (color)  "Give the complementary of a hex color following "  (rgbtohex (rgbcomplementary (hextorgb color))))(defun hextorgb (hexcolor)  "string in, int list out"  (format t "~% hexcolor: ~S" hexcolor)  (list  (parse-integer (subseq hexcolor 1 3) :radix 16)	 (parse-integer (subseq hexcolor 3 5) :radix 16)	 (parse-integer (subseq hexcolor 5 7) :radix 16)))(defun rgbtohex (rgbcolor)  "int list out, string in"  (format t "~% rgbcolor: ~S" rgbcolor)  (concatenate 'string	       "#"	       (format nil "~2,'0X" (nth 0 rgbcolor))	       (format nil "~2,'0X" (nth 1 rgbcolor))	       (format nil "~2,'0X" (nth 2 rgbcolor))))	 (defun rgbcomplementary (rgbcolor)  "int list in, int list out"  (format t "~% before complementary: ~S" rgbcolor)  (let ((res nil))    (dolist (el rgbcolor (nreverse res))      (push (- 255 el) res))));; second method (floor (sqrt (- (* 255 255) (* el el)))) res))))

No.875112

>>875034

Neither of those things happen, it's a programming language, not an editor

No.876387

I have a weird question, lads. I am thinking of making a package manager frontend (like Synaptic or Gnome Software) as a personal coding project, but I can't find any documentation on how to actually interact with the package managers with another program. I'm searching in the source code to these programs and I can't find the part where they actually query the installed programs, repos, etc. Do they literally just run the commands and then parse the output, or is there some buried API they're using?

Can anyone help me and point out which file is doing the work? Either is fine...

https://github.com/GNOME/gnome-software

https://github.com/mvo5/synaptic

No.876411

>>876387

>Do they literally just run the commands and then parse the output

Yes. That is the Unix/Linux/Gahnoo/Loonix way.

No.876435

>>876387

libapt-pkg

No.876440

>>876435

oh nice, so this stuff?

https://github.com/mvo5/synaptic/search?utf8=%E2%9C%93&q=apt-pkg&type=

https://github.com/Debian/apt/tree/master/apt-pkg

That's good for apt, but I don't see an equivalent for DNF for instance. So do some package managers have a low-level API while others don't? For them is it still like this guy >>876411says?

No.877430

Trying out ATS2 today. Gotta say I don't get it at all. Getting the compiler working took a while and there are very few examples but whatever. I managed to get as far as trying to apply a function over a list before I got confused by types.

The error messages are classic stuff though.

273(line=17, offs=10) -- 273(line=17, offs=10): error(3): unsolved constraint: C3NSTRprop(C3TKmain(); S2Eapp(S2Ecst(<=); S2EVar(5094->S2Eapp(S2Ecst(add_int_int); S2Evar(m(8767)), S2Eintinf(1))), S2EVar(5095->S2Evar(n(8768)))))typechecking has failed: there are some unsolved constraints: please inspect the above reported error message(s) for information.exit(ATS): uncaught exception: _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)

As you can see it has a nice autistic minimalism that makes you feel like a haaaacker. So I'll give it a few more days.

No.878543

New guy here. How do I make a box around my code?

No.878552

No.884465

File: ae43ae165769184⋯.png (20.32 KB, 825x227, 825:227, 2018-03-18-001925_825x227_….png)

My project isn't big enough to warrant its own thread, but I've been working on a BBS like software to be used over tor.

Right now it only really support a chatroom, but I have plans to add some other features like mail, and customized user pages.

The project is called Zyrod and it's licensed under the AGPLv3.

You can find the source at: https://gitgud.io/zyrod/zyrod

You can join my instance at: zyrod3akfrytejihgoofmarjhojorwxd6cvf55qyqr476e5msac7nhqd.onion:54706

No.884804

[M]embers: View a list of registered members

[W]arranty: View the warranty.

I also set it up so that when I push my code to the remote repository the onion server automatically pulls the latest code down and restarts Zyrod.

No.884812

>>877430

>please inspect the above reported error message(s) for information

<C3NSTRprop(C3TKmain(); S2Eapp(S2Ecst(<=); S2EVar(5094-S2Eapp(S2Ecst(add_int_int); S2Evar(m(8767)), S2Eintinf(1))), S2EVar(5095-S2Evar(n(8768)))))

t-thanks

No.884838

File: 00d40a1b45aaab4⋯.png (15.63 KB, 933x261, 311:87, 2018-03-18-202440_933x261_….png)

>>884804

>>884465

Probably the last thing I'll add tonight to Zyrod.

Fortune.

No.884976

File: 666f33e4ba5eaca⋯.png (50.16 KB, 870x1448, 435:724, easy short programming.png)

I just tried the "print number in binary" with python.

def tobinary(n):  binarystring = ''  place = total = 1  while (n > total):    # Get highest binary place possible for n    place <<= 1    total += place  highestplace = place  while (highestplace > 0):    # Get binary equivalent of n    if (n >= highestplace):      binarystring += '1'      n -= highestplace    else:      binarystring += '0'    highestplace >>= 1  return binarystringprint(tobinary(37))

No.885020

Is K&R still relevant for learning C?

No.885027

>>885020

No. Btw rollin

No.885047

>>885020

It's the only C book worth reading

No.885065

>>885027

>>885047

Both of these are wrong.

No.885076

>>885027

    fn main() {    // let mut args = std::env::args().skip(1);    let args = vec!("masterpassword", "facebook.com", "Adolf Hitler");    let mut args = args.iter();        if args.len() < 2 {        eprintln!("Usage: pass <password> <args>...");        std::process::exit(1);    }        let hash = hash_impl(std::iter::once(password_hash(args.next().unwrap().as_bytes()))    .chain(args.map(|s| hash(s.as_bytes()))));            println!("{:x}{:x}", hash.0, hash.1);}macro_rules! round {    ($x:expr,$y:expr, $k:expr) => { *$x = $x.rotate_right(8); *$x = $x.wrapping_add(*$y);        *$x ^=$k;        *$y =$y.rotate_left(3);        *$y ^= *$x;    }}fn key_schedule(ks: &mut [u64], (mut k2, mut k1): (u64, u64)) {    for (i, k) in ks.iter_mut().enumerate() {        *k = k2;        round!(&mut k1, &mut k2, i as u64);    }}fn encrypt(ks: &[u64], &mut (ref mut m2, ref mut m1): &mut (u64, u64)) {    for &k in ks {        round!(m1, m2, k);    }}fn hash(data: &[u8]) -> (u64, u64) {    fn read_u64<I: Iterator<Item = u8>>(iter: &mut I) -> u64 {        iter.take(8).fold(0, |acc, b| (acc << 8) | b as u64)    }        hash_impl(data.chunks(16).map(|c| {        let mut c = c.iter().cloned();        (read_u64(&mut c), read_u64(&mut c))    }))}fn hash_impl<I: Iterator<Item = (u64, u64)>>(iter: I) -> (u64, u64) {    let mut ks = [0; 32];    let mut state = (0x6A09E667F3BCC908, 0xBB67AE8584CAA73B);        for k in iter {        key_schedule(&mut ks, k);        encrypt(&ks, &mut state);    }        key_schedule(&mut ks, (0, 0));    encrypt(&ks, &mut state);        state}fn password_hash(data: &[u8]) -> (u64, u64) {    let mut ks = [0; 32];    key_schedule(&mut ks, hash(data));        let mut state = [(0u64, 0u64); (4 << 20) / 16];    let mut block = (0, 0);        for m in state.iter_mut() {        encrypt(&ks, &mut block);        *m = block;    }        for _ in 0..state.len() {        let i = block.0 as usize % state.len();        block.0 ^= state[i].0;        block.1 ^= state[i].1;                encrypt(&ks, &mut block);        state[i] = block;    }        hash_impl(state.iter().cloned())}
https://play.rust-lang.org/?gist=400dbdd653cfdbfe528beba3b8cfc03f

No.885078

Any recommendations on whether to use SDL2 or GLFW for a home-made game engine? I'm mostly worried about input lag.

No.885142

Roll

No.886176

rolling

No.888743

Did #18

import os, sysfrom PIL import Imagedef imgtoascii(pathtoimg):  charx = 2  chary = 5  rangepervalue = 3  asciiequivalent = (    "@", "#", "M", "B", "H", "E", "N", "R", "K", "W",    "X", "D", "F", "P", "Q", "A", "S", "U", "Z", "b",    "d", "e", "h", "x", "8", "&", "G", "*", "m", "O",    "4", "a", "g", "n", "s", "6", "9", "o", "w", "z",    "$", "C", "I", "u", "2", "3", "J", "c", "f", "r", "y", "%", "1", "v", "7", "l", "+", "i", "t", "[", "]", "{", "}", "?", "j", "|", "(", ")", "=", "~", "!", "-", "/", "<", ">", '"', "^", "_", "'", ";", ",", ":", "", ".", " " ) # Check if pathtoimg is valid then convert to grayscale try: img = Image.open(pathtoimg).convert("LA") except IOError: print("Unable to open file") return False output = open(os.path.splitext(pathtoimg)[0]+".txt", "w") line = "" imgx, imgy = img.size # Loop through image and get each region to be converted to ASCII for y in range(0, imgy, chary): for x in range(0, imgx, charx): region = (x, y, x+charx, y+chary) grayscaleval = getgrayscalevalue(img.crop(region)) / rangepervalue grayscaleval = 0 if (grayscaleval == 0) else (grayscaleval - 1) line += asciiequivalent[grayscaleval] output.write(line + "\n") line = "" output.closedef getgrayscalevalue(region): total = 0 pixels = list(region.getdata()) for pixel in pixels: total += pixel[0] return(total/len(pixels))if __name__ == "__main__": for arg in sys.argv: imgtoascii(arg) No.889692 rollan XDD No.890708 File: fcc8c889ef3408c⋯.jpg (210.41 KB, 676x700, 169:175, fcc8c889ef3408cf48ddb8a630….jpg) Two assembly related questions since I just started learning it a while away. >saving .data on RAM Since you need to save words as external data to load wouldn't you eventually reach a point where it could be better to just have the entire alphabet in memory and load letter per letter to write sentences or would the bloat in code be worse than the little memory you earned by not having a hundred different sentences hard coded? >final variables Not exactly about assembly itself, but how do compiler treat final variables in most languages, is it just hard coded into a load integer or does it still create a pointer for it? No.890714 >>864336 >Python would be more professionally useful for me to know but it just feels so degenerate to not have brackets. You can use brackets in Python if you're so clingy to them... They're optional, but supported. No.890716 >>864344 >Python 3 is a better language than Python 2 in a lot of ways, some of them backward incompatible. ...and worse in lots of other ways. >divide two integers >get a float as a result >brainlet_wojak.jpg No.890719 /g/ image physically remove yourself No.890722 >>890708 Your questions don't make any sense. No.890744 1. Assuming you are just using ASCII it would take 1 byte to store a character. With your idea, you would store a byte as the offset into an alphabet. Either way you are using a byte, so you should just use regular strings. If you are worried about file size, look into compression. 2. Depending on the language and platform, it might through it into a segment of memory which only has read access. No.890748 No.890749 >>890744 >Either way you are using a byte, so you should just use regular strings. But if you were to make an assembly program with a fuckton of strings, would there eventually be a tipping point where it's be better to use an alphabet over strings? >If you are worried about file size, look into compression. It's not so much that I'm worried about size, I don't plan on doing something like that for now, it's more just curiosity. >it might through it into a segment of memory which only has read access. I guess that's not as bad. Does the C standard say anything about it? I tried searching but I couldn't find anything. No.890810 >>890749 >would there eventually be a tipping point I was saying there is no tipping point as your idea is always worse assuming I understand it correctly. It will take up the same amount of bytes except you have the overhead of storing an alphabet too. It might be easier to think of storing plain ascii as loading each letter by its ascii code. Maybe I'm wrong and you are talking about storing graphics for text. In that case take a look at what bitmap fonts are. >Does the C standard say anything about it? I don't think it says anything beyond not being able to change it at compile time. C was designed to be architecture agnostic, so they left out a lot of details to be filled in by the implementation of it. No.890953 File: c37b218df36cd2e⋯.jpg (163.17 KB, 800x800, 1:1, c37b218df36cd2e6f67a4865c4….jpg) >>890810 >I was saying there is no tipping point as your idea is always worse assuming I understand it correctly. Yeah, I was being retarded, I just remembered how many instructions you'd need to load each letter. >>890810 >I don't think it says anything beyond not being able to change it at compile time. C was designed to be architecture agnostic, so they left out a lot of details to be filled in by the implementation of it. Welp. Compilers always do whatever when it's not specified, so I guess there's no way to know. Thanks anyway, have some robot tits. No.891132 Having some fun with boot loader graphics. Here's a shitty poc animation that's short enough to fit here. [BITS 16][ORG 0x7c00]mov ax, 0x13 ; mode 13int 0x10push 0xA000 ; vid mempop espush 0x8000 ; buffer addr for swappingpop fs m: call clear_buffer call sleep call draw call render jmp mclear_buffer: mov ax, 0x47 ;;color mov bx, 0 ;; offset mov dx, 1 ;; direction mov cx, 0xffff ;; length call horiz ; fill the screen with the background color render: call sleep call swap_buffer ret swap_buffer: push fs pop ds ; put vid mem addr into ds xor si, si xor di, di mov cx, 320*200/2 rep movsw ; move cx word from ds:esi to es:edi in this case 0x8000 -> 0xA000 retdraw: mov ax, 0x29 mov cx, 1 mov bx, 0x0 mov cx, 200/2.l1: push cx ; loop cnt mov dx, 1 ; dir push bx call horiz pop bx add bx, 320*2 pop cx loop .l1 rethoriz: mov BYTE [fs:bx],al add bx, dx loop horiz call render retsleep: ; loss of cx, dx push ax xor cx, cx mov cx, 0 mov dx, 0xA2C2 ;; kino 24 fps mov ah,0x86 int 0x15 pop ax ret;padding boot loader magic numtimes 446-($-) db 0times 64 db 0xffdw 0xaa55

nasm <file> -f bin -o boot.binqemu-system-x86_64 -fda boot.bin

No.891142

>>891132

Real mode assembly is great. Here's a fun one I found:

http://skullcode.com/bootstrap/hexboot.txt

It's a hex editor in a boot sector!

No.891147

>>891142

damn that is cool

No.891148

>>891132

man assembly looks fun. does the program step into "m" after the "pop fs"? Also, if "m" keeps looping on itself, how does the program actually terminate?

No.891151

>>891148

>looks fun

until you have to debug it

>>891148

>program step into "m"

Things like "m:" are just labels. Labels just provide an easy way to refer to a specific line of the program. When being assembled it will but the call clear_buffer line right after pop fs.

>how does the program actually terminate

It doesn't.

No.891155

>>890716

literally just use the integer division operation

No.891165

>>891151

Ok, cool. I know about labels, but you answered my question regardless. Debugging is just part of the fun - and furious frustration.

No.891172

>>891165

It just gets annoying when you have to restart the whole computer when it crashes, though I guess you could call it more of a fault with low level development where you have nothing to save you if you mess up.

No.891182

>>891172

Right. Maybe having two computers - one for development and one for testing - would speed things up.

No.899282

How hard is it to get a remote programming job? Am I going to have to do web development if I want this? I just want a job that will let me travel (on my own, not as a job requirement).

I already had a hard enough time and gave up on trying to get a regular programming job after graduating with a 2 year degree, but then again I live in the middle of fucking nowhere so there's like 10 jobs available and all are senior positions.

No.899289

>>899282

Also is freelancing really even viable? I've looked into freelancing before and it honestly just always looked like it's not worth bothering with.

No.899325

>>899282

It's not easy, even if you already have a programming job. It obviously depends on the company but I think most people who program remotely usually start out on site. Or nepotism.

No.899329

>>899325

How common would it be for employers to let you work from home for like a few weeks at a time in an otherwise office job?

No.899982

>>863611

>Working on code? Post it here!

I wrote a library in C to work with some proprietary file formats of Devil May Cry 1.

https://git.teknik.io/scuti/lib3ddevil1

No.906753

File: 5dfa18fec3e42a9⋯.png (107.07 KB, 729x714, 243:238, s t a l i n.png)

No.906776

>>899982

Cool. What kind of tools did you find useful for the job?

>>906753

>LASTINFIRSTOUT

>LOL It's Stalin.

No.908437

Rate my privilege escalation exploit

#include <stdio.h>#include <stdlib.h>void root()  //You're dead Linuxfags{	char input;	scanf("%c", &input);	while(input == '\n')	{		printf("root:~ ");		scanf("%c", &input);	}}int main(){root(); //This is where the magic happens, should've written this in superior Rust or this wouldn't have happenedreturn 0;}

No.912990

>>863611

How on Earth are the Mandelbrot set and vector products considered harder than an imageboard or a neural network?

No.913249

>>912990

make a better one then

No.913292

roll

No.913297

>>913292

ok reroll

No.913816

>>906776

>Cool. What kind of tools did you find useful for the job?

With regards to the file itself, a hex editor for basic checks that the program was reading binary data correctly. The programming and whatever just uses the GNU toolchain.

No.913819

>>913816

How did you know what to with the data though?

No.913838

No.913850

I'm working on C64 demo. Got 2 parts ready and I'm finishing up the third one. I want to make 5 of them. I can post the source code tomorrow (I'm not on the computer anymore)

https://youtu.be/bDd0bf8Cf0w

https://youtu.be/Sa1VsZR1GOI

No.913884

>>913838

No.913968

Did the cipher one

#lang racket(require racket/set);;;Making it better;;;Include more punctuation;;;Include uppercase letters;;;Key Cipher Caeser;;;Insert a set (S1) with unique letters only 'test' -> 'tes';;;at the beginning of the the set of letters A-Z (S2);;;Which corresponds to the standard letters S3;;; S1 + S2 = cipher;;; 'tesabcd...' with 'tes' and 'abc...'(define alphabet "abcdefghijklmnopqrstuvwxyz");;;Generate a set of unique letters from a string(define (string->set str)  (list->string (remove-duplicates (string->list str))));;;Add S1 to S2(define (generate-cipher word)  (let ((set1 (filter (lambda (x) (not (char=? x #\space)))                      (string->list (string->set word))))        (set2 (string->list alphabet)))    (list->string (remove-duplicates (append set1 set2)))));;;Takes strings as arguments to generate cipher;;;adds space character to allow for spaces in strings(define (simple-zip lst lat)  (map (lambda (x y) (list x y))        (cons #\space (string->list lst))       (cons #\space (string->list lat))));;;Search cipher (such as [[#\a #\j]] to find the corresponding;;;shifted letter(define (find-cipher-alphabet cipher letter)  (cadr (findf (lambda (arg)                 (char=? (car arg) letter))               cipher)))(define test-cipher (simple-zip                      alphabet                      (generate-cipher "julius caesar")));;;Abstracted boilerplate(define (generic-cypher cypher inp)  (list->string   (map (lambda (x) (find-cipher-alphabet cypher x))        (string->list inp))));;;Simply reverse the cipher to decrypt(define (decrypt-with-cypher cypher inp)  (generic-cypher (map reverse cypher) inp))(define (encrypt-with-cypher cypher inp)  (generic-cypher cypher inp))`

Bretty shitty