 |
 |
 |
What is the last thing you thought?, Tech Edition |
|
Feb 21 2021, 07:26
|
Moonlight Rambler
Group: Gold Star Club
Posts: 6,500
Joined: 22-August 12

|
I forget if I've shared this before, but I wrote a JSON prettifier in PHP. Reads from stdin (or a single file argument can be passed). Has a couple minor issues, but overall works okay. Usage example: CODE curl --silent --header "Content-Type: application/json" --request POST --data '{ "method": "gdata", "gidlist": [ [1826701,"9ea7a1b494"] ], "namespace": 1}' https://api.e-hentai.org/api.php | prettifyjson Returns: CODE { "gmetadata": [ { "gid": 1826701, "token": "9ea7a1b494", "archiver_key": "448301--6710c3460f71c23ad83c023e83fc7dfa76ad150c", "title": "[Still In The Simulation] The Bikini Bottom Horror: Seasons 1-4 (complete) (Spongebob Squarepants) [English]", "title_jpn": "", "category": "Misc", "thumb": "https:\/\/ehgt.org\/47\/37\/4737425486b8b590a1d70d906dc8170f05b90e58-13654433-2520-3283-jpg_l.jpg", "uploader": "kikimaru024", "posted": "1610815233", "filecount": "64", "filesize": 273319409, "expunged": false, "rating": "4.94", "torrentcount": "0", "torrents": [ ], "tags": [ "language:english", "parody:spongebob squarepants", "character:patrick star", "character:sandy cheeks", "character:spongebob squarepants", "character:squidward tentacles", "male:crab", "male:guro", "male:muscle", "male:octopus", "male:snuff", "female:squirrel girl", "story arc", "western non-h" ] } ] }
Ugly sources for the prettifier: CODE #! /usr/bin/php <?php // read from stdin and pretty-print output header("Content-Type: text/plain"); # $json1=$_POST["jsonString"]; if($argc > 1) { $json1=file_get_contents($argv[1]); if($json1 === FALSE) { echo "Error opening file!"; exit(1); } } else { $json1=file_get_contents("php://stdin"); } echo jsonToReadable($json1);
//the function for formatting function jsonToReadable($json){ $tc = 0; //tab count $r = ''; //result $q = false; //quotes $t = " "; //tab $nl = "\n"; //new line
for($i=0;$i<strlen($json);$i++){ $c = $json[$i]; if($c=='"' && $json[$i-1]!='\\') $q = !$q; if($q){ $r .= $c; continue; } switch($c){ case '{': case '[': $r .= $nl . str_repeat($t, $tc) . $c . $nl . str_repeat($t, ++$tc); break; case '}': case ']': $r .= $nl . str_repeat($t, --$tc) . $c; break; case ',': $r .= $c; if($json[$i+1]!='{' && $json[$i+1]!='[') $r .= $nl . str_repeat($t, $tc); break; case ':': $r .= $c . ' '; break; default: $r .= $c; } } $r .= $nl; // append a final new line return $r; } ?> This post has been edited by dragontamer8740: Feb 21 2021, 07:49
|
|
|
|
 |
|
Feb 21 2021, 18:30
|
blue penguin
Group: Gold Star Club
Posts: 10,046
Joined: 24-March 12

|
Did you just rewrite a small version of [ stedolan.github.io] jq?
|
|
|
|
 |
|
Feb 22 2021, 09:44
|
Moonlight Rambler
Group: Gold Star Club
Posts: 6,500
Joined: 22-August 12

|
QUOTE(blue penguin @ Feb 21 2021, 11:30)  Did you just rewrite a small version of [ stedolan.github.io] jq? Not intentionally, no. I'd never heard of jq. Based on how many files there are, I kind of suspect that there's a lot more to jq than there is to my PHP script. But with that said, if I'm reading documentation properly, it looks like I did implement pretty much its default behavior when no arguments are passed? Is that right? Neat project, anyway; I think I might try it (I'm happy it's written in C rather than some more horrible language). Thanks for letting me know about it. Sort of wish I'd seen it earlier. Still, since it's larger than just using a makefile I'm assuming it's overkill for what I'm doing (especially since they fell for the Docker meme). Edit: CODE ./configure --enable-all-static --without-oniguruma …on git master creates a segfaulting binary. Also, I think the following may not be necessarily true: QUOTE jq is written in portable C, and it has zero runtime dependencies. You can download a single binary, scp it to a far away machine of the same type, and expect it to work. See also the following linker warning: QUOTE jq/src/util.c:106: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking It's also silly and superfluous how JQ performs coloration by default. It necessitates an extra '|cat' at the end to get monochromatic text. As an aside, because my program is incredibly naïve, it performs much faster than, for example, JSON.stringify() in javascript. This post has been edited by dragontamer8740: Feb 22 2021, 10:10
|
|
|
|
 |
|
Feb 22 2021, 10:48
|
Wayward_Vagabond
Group: Gold Star Club
Posts: 6,305
Joined: 22-March 09

|
Got a DisplayPort KVM switch, minus the chinglish documentation it seems well made. It doesn't seem to maintain usb presence on the systems, but unsure if it does for the monitor. My monitor definitely sees a gap in video and takes a couple seconds to display again- so I don't know what the syatem is doing in that time period. I suspect it doesn't, but with a single monitor it doesn't seem to be an issue. Also got an HDMI adapter to allow use of a pi or console with it. Adapter worked with a graphics card HDMI out at least.
PSU is stuck in a UPS facility in Houston. I suppose I can't rightly be upset, so it'll get here when it gets here.
This post has been edited by Wayward_Vagabond: Feb 22 2021, 14:46
|
|
|
|
 |
|
Feb 22 2021, 17:18
|
Moonlight Rambler
Group: Gold Star Club
Posts: 6,500
Joined: 22-August 12

|
My only KVM switch is a VGA/AT keyboard (no mouse) one from the 80's with one of the mechanical rotary switches.
I'd like a newer one but just never really feel like I can justify it.
This post has been edited by dragontamer8740: Feb 22 2021, 19:38
|
|
|
Feb 22 2021, 20:27
|
Moonlight Rambler
Group: Gold Star Club
Posts: 6,500
Joined: 22-August 12

|
Is there a good generic place-filler for expresscard (54mm) slots? I need something to structurally support the palmrest in my thinkpad x201, and my USB 3.0 expresscard sometimes gets quite warm.
This post has been edited by dragontamer8740: Feb 22 2021, 20:29
|
|
|
Feb 23 2021, 01:55
|
Wayward_Vagabond
Group: Gold Star Club
Posts: 6,305
Joined: 22-March 09

|
I have a dual monitor VGA + USB + audio one I keep meaning to throw on ebay. Works fine, I just don't have a need for it anymore.
Laptop makers do make/include slot fillers, and they are on ebay, but you really have to be fuzzy with your terms to find them.
|
|
|
|
 |
|
Feb 23 2021, 02:32
|
EsotericSatire
Group: Catgirl Camarilla
Posts: 12,776
Joined: 31-July 10

|
QUOTE(dragontamer8740 @ Feb 22 2021, 08:27)  Is there a good generic place-filler for expresscard (54mm) slots? I need something to structurally support the palmrest in my thinkpad x201, and my USB 3.0 expresscard sometimes gets quite warm.
Yes but I haven't seen the specific thinkpad ones for ages. You can get brackets that fit in the slot The closest I could easily find was the StarTech Ecbracket2 ExpressCard 34mm to 54mm Stabilizer Adapter - 3 P that will add stability in the slot but not do anything. You could also just by a cheap wifi or bluetooth card. Aliexpress is also selling replica express card slot plugs. eg Toshiba Satellite P100 p100-196 17 "card plug on the slot ExpressCard 54
|
|
|
Feb 23 2021, 11:37
|
Anime Janai
Group: Members
Posts: 1,090
Joined: 23-February 09

|
I miss when Intel microprocessors came in [ en.wikipedia.org] white ceramic.
|
|
|
Feb 23 2021, 20:00
|
Coooomer
Newcomer
 Group: Members
Posts: 27
Joined: 9-February 21

|
tether is going to drag btc to its grave
|
|
|
Feb 23 2021, 23:55
|
Moonlight Rambler
Group: Gold Star Club
Posts: 6,500
Joined: 22-August 12

|
QUOTE(Anime Janai @ Feb 23 2021, 04:37)  I miss when Intel microprocessors came in [ en.wikipedia.org] white ceramic. Nah, purplish-brown ceramic's where it's at This post has been edited by dragontamer8740: Feb 23 2021, 23:58
|
|
|
Feb 24 2021, 02:18
|
EsotericSatire
Group: Catgirl Camarilla
Posts: 12,776
Joined: 31-July 10

|
The good ole days when comps had 1mb hard drive and 128kb of ram.
|
|
|
Feb 25 2021, 04:14
|
Moonlight Rambler
Group: Gold Star Club
Posts: 6,500
Joined: 22-August 12

|
QUOTE(EsotericSatire @ Feb 23 2021, 19:18)  The good ole days when comps had 1mb hard drive and 128kb of ram.
Actually the Amiga 1000 has 256kb of chip RAM. Expandable to 512KB. Apparently the A1000 could use A500 sidecars, but only if they were inserted backwards. That means if I ever get an A1000 I'll be able to use my A500 hard disk drive with it, which'll be nice.
|
|
|
|
 |
|
Feb 25 2021, 15:40
|
Wayward_Vagabond
Group: Gold Star Club
Posts: 6,305
Joined: 22-March 09

|
Was looking into how to add a printer to a 5GHz N wifi network (printer only has USB and 2.4GHz interfaces). I could not find a USB print server that supports 5GHz. Since the product I need doesn't seem to extant, cheapest option seems to be adding a 2.4GHz G network for the printer. If the printer had ethernet, I could get a 5GHz to ethernet bridge to get it networked.
Power supply is out for delivery today, how much space is on the front and how much free depth there is behind may dictate my output terminal choices.
Related to the KVM, turns out mini-USB cables with all 5 pins wired up are hard to find. I was attempting to tap power for the HDMI converter from the remote port on the KVM- It's not USB, but it puts power in the same spot and low enough voltages nothing breaks if you try to mix it and USB. Why trying to avoid chopping up the cable to do that. I wanted to tap power tbere because it's ORed from either input USB and ac adapter (if present) and won't hog a front panel port. Edit: There are USB A Y-cables that pass data + power down one leg, and power only down the other. Just gonna use that to get power.
This post has been edited by Wayward_Vagabond: Feb 25 2021, 16:10
|
|
|
|
 |
|
Feb 26 2021, 13:37
|
uareader
Group: Catgirl Camarilla
Posts: 5,594
Joined: 1-September 14

|
I'm doing it randomy by hand, with low success, thus it make wonder: if I used an actual software to increase the size of .ass subtitles through the PlayRes X,Y parameters, would the program be able to smartly adjust the use of \pos and \move in the rest of the file? I'm afraid it would do a lot of unnecessary (from my (subjective) point of view) things, hence why I didn't try to get an actual program (that, and garbages from more installation, I already apparently have 2 installations of Notepad++ for a reason I will have to uncover some day))
|
|
|
Feb 26 2021, 18:51
|
Moonlight Rambler
Group: Gold Star Club
Posts: 6,500
Joined: 22-August 12

|
Sounds like a task for writing your own script.
But since you use windows that might not be too easy for you.
|
|
|
|
 |
|
Feb 26 2021, 20:45
|
Moonlight Rambler
Group: Gold Star Club
Posts: 6,500
Joined: 22-August 12

|
Today I discovered there appears to be a 2.66GHz non-low-voltage variant (i5-560M) of my X201 tablet. I bet battery life is terrible, but now I want one, since it'd have a faster-clocked integrated GPU.
Not gonna pay a premium for one, though, so I guess I'll just wait and check in every so often on ebay listings. They don't appear to be very common when compared to mine (a 2.13GHz i7-640LM one, which appears to be the second highest clocked model and which uses a low-voltage CPU).
The good thing about already having one in nice shape though is that if I do find one in horrible condition I can likely just swap the motherboards.
For now, mine is still more than adequate and I still love it, of course.
Also, looking at buying an old SCSI scanner with an ADF. Max. 1200×1200 DPI should be plenty, right? Been a while since I last scanned something.
I have an adaptec SCSI controller card, btw. I hope I have all the other adapters I need but i'm willing to buy one if I don't have it. I think I have DB-25 to 50-pin here somewhere, both "centronics" 50 and the sort of d-sub-like 50. I think the only adapter I don't own is 50→68.
Also, finally changed my I/O scheduler to bfq and I'm going to see if that makes interactive use a little bit less laggy on my laptop with spinning rust.
This post has been edited by dragontamer8740: Feb 26 2021, 23:02
|
|
|
|
 |
|
Feb 27 2021, 05:57
|
Scumbini
Group: Gold Star Club
Posts: 919
Joined: 2-December 15

|
QUOTE(dragontamer8740 @ Feb 26 2021, 13:45)  Also, finally changed my I/O scheduler to bfq and I'm going to see if that makes interactive use a little bit less laggy on my laptop with spinning rust.
I feel like my last couple of HDD based machines run more responsively with it but I haven't tested anything empirically so it could easily be placebo. In any case the bfq placebo feels snappier than the mq-deadline placebo I suppose.
|
|
|
|
 |
|
Feb 27 2021, 08:24
|
Moonlight Rambler
Group: Gold Star Club
Posts: 6,500
Joined: 22-August 12

|
QUOTE(Scumbini @ Feb 26 2021, 22:57)  I feel like my last couple of HDD based machines run more responsively with it but I haven't tested anything empirically so it could easily be placebo. In any case the bfq placebo feels snappier than the mq-deadline placebo I suppose.
My machine was grinding to a halt for minutes at a time with mq-deadline, occasionally, if I did heavy file I/O or ran photoshop in wine and needed to use swap space. Could be a misconfiguration or just a terrible hard disk (it's a 2TB 2.5" drive, so it's probably just inherently slower on account of how it stores the data so dense). I think it's definitely a slower drive on average than my previous smaller capacity one was. My desktop performs just fine on mq-deadline; granted that machine has multiple HDD's, and boots from an old (probably still longitudinal-recording) 500GB HDD so it definitely isn't dealing with SMR or anything like that like my laptop is. Also most of the drives in that machine run at 7200RPM (or higher; I have a 10K RPM ultra320 SCSI drive in there). This post has been edited by dragontamer8740: Feb 27 2021, 08:25
|
|
|
|
 |
|
Feb 27 2021, 13:35
|
Pillowgirl
Group: Gold Star Club
Posts: 5,458
Joined: 2-December 12

|
QUOTE(uareader @ Feb 26 2021, 21:37)  I'm doing it randomy by hand, with low success, thus it make wonder: if I used an actual software to increase the size of .ass subtitles through the PlayRes X,Y parameters, would the program be able to smartly adjust the use of \pos and \move in the rest of the file? I'm afraid it would do a lot of unnecessary (from my (subjective) point of view) things, hence why I didn't try to get an actual program (that, and garbages from more installation, I already apparently have 2 installations of Notepad++ for a reason I will have to uncover some day))
Did you try editing it in Aegisub?
|
|
|
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:
|
 |
 |
 |
|