2,427 karma · joined Jun 15, 2023 (3y ago) · 1,641 submissions
comment 3y ago · link · parent
$> csvData = @"
Name,Department,Salary
John Doe,IT,60000
Jane Smith,Finance,75000
Alice Johnson,HR,65000
Bob Anderson,IT,71000
"@;
$> csvData
| ConvertFrom-Csv
| Select Name, Salary
| Sort Salary -Descending
Name Salary
---- ------
Jane Smith 75000
Bob Anderson 71000
Alice Johnson 65000
John Doe 60000
You can also then convert the results back into CSV by piping into ConvertTo-Csv $> csvData
| ConvertFrom-Csv
| Select Name, Salary
| Sort Salary -Descending
| ConvertTo-Csv
"Name","Salary"
"Jane Smith","75000"
"Bob Anderson","71000"
"Alice Johnson","65000"
"John Doe","60000"comment 3y ago · link · parent
$> (invoke-webrequest "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.csv").Content
| ConvertFrom-Csv
| sort "usd"
| select "date" -first 1
Date
----
2000-10-26
Doing it with a zip file would be a little more verbose since there is no built in "gunzip" type command which operates on streams, but you can write one which does basically that out of built in .Net functions: function ConvertFrom-Zip {
param(
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
[byte[]]$Data
)
process {
$memoryStream = [System.IO.MemoryStream]::new($Data)
$zipArchive = [System.IO.Compression.ZipArchive]::new($memoryStream)
$outputStreams = @()
foreach ($entry in $zipArchive.Entries) {
$reader = [System.IO.StreamReader]::new($entry.Open())
$outputStreams += $reader.ReadToEnd()
$reader.Close()
}
$zipArchive.Dispose()
$memoryStream.Dispose()
return $outputStreams
}
}
and call it like: # unary "," operator required to have powershell
# pipe the byte[] as a single argument rather
# than piping each byte individually to
# ConvertFrom-Zip
$> ,(invoke-webrequest "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip").Content
| ConvertFrom-Zip
| ConvertFrom-Csv
| sort "usd"
| select "date" -first 1
Date
----
2000-10-26
I love powershellcomment 3y ago · link · parent
comment 3y ago · link · parent
I truly believe that most people wouldn't give a shit about either of these issues if they weren't being told to give a shit about these issues. These issues are signals for political tribes and most people are far less ideological than they think they are. The monkey parts of their brains are being manipulated for reasons as arbitrary as the religious wars of the 16th century.
comment 3y ago · link · parent
> Despite the steady drumbeat of this mantra, there wasn’t much internal understanding of what it meant, let alone a strategy of how we were going to accomplish it.
The headline for Forward right now is: get ranked choice voting and open primary ballots passed in as many states as possible using ballot initiatives in the states that have them. That is the main thing they focus on. If she, the press secretary, didn't know that, then perhaps the organization has a communication problem, but that's not a lack of a platform. Forward doesn't take positions on the current hot topic political issues like guns or abortion because they don't believe we can legitimately solve or come to a consensus on these problems with the incentives which exist in our current political system. Therefore, the strategy is to unite people from the left and right to create a new set of rules we can agree on, and then use those rules to solve our disagreements.
Her references to tech companies is a familiar, but irrelevant criticism of Andrew Yang: to label him a clueless tech bro and equate him, somehow, with the financial fraud of con artist Elizabeth Holmes or the market failure of WeWork (two companies which are completely unlike each other) is a common refrain of his detractors (usually, though, these criticisms come from the DNC, not the Republicans). They want to label him as another product of San Francisco tech culture trying to solve complex political problems with engineering-inspired solutions. This is not what Forward is about
> While the party supports electoral reforms such as ranked choice voting, independent redistricting commissions and open primaries, it is agnostic when it comes to having policy stances, believing it is better to not take a stand on voting issues than plant a flag and alienate people.
>That’s right — no platform laying out party principles and positions, no policies, no plan. Only showmanship.
I don't know how she can define the most important policies of the party in one sentence, and in the very next breath claim that it has no policy positions just because their party isn't about getting screaming matches over abortion or transgender athletes.
comment 3y ago · link · parent
comment 3y ago · link · parent
Targeted advertising has existed in some way since we invented advertising. Knowing that certain people (e.g: rich vs poor) are more likely to live near a certain billboard informs you whether or not you should buy a billboard there. Nielsen has been collecting data on TV watchers since the 1950s and that informed the TV networks which timeslots and on what channels they should advertise on, and what they should pay.
We need to have laws on how we target advertising. Reddit, for example, allows you to target ads to specific subreddits, rather than users. Most people are fine with this idea, since it doesn't require reddit to know anything about the user, just about what page is the user on. This kind of targeted advertising is the most common, as sites will share information with ad exchanges on the type of content which is available on their site (rather than having to track the user themself).
comment 3y ago · link · parent
Quantifying human labor (especially knowledge work) is extremely difficult, and I think you need to just have an organic, on-the-ground view of it. Project managers that know how to code and what kind of work goes into a problem can better understand the level of effort for a particular problem, then you can see who is pulling their weight and who isn't.
comment 3y ago · link · parent
One problem with how we measure this is that we use test scores as our metric and target. We ask "does homework improve test scores, which we implicitly accept as the definitive metric for learning" rather than "does homework improve learning".
Closed note, closed book, timed, silent tests are not a thing that occurs anywhere outside of academic environments. In real life, you are expected to use resources to solve problems. Homework may really only help with test scores (if it does that at all) since it helps with rote memorization. In order to pass a calculus test, you are expected to do 100 calculus problems and try to pattern-match the integral on the test to the handful of integration algorithms you were drilled on, then manipulate the symbols to get the desired result. However, if most people were asked to use calculus in solving a problem or modeling something, they'd be utterly lost because calculus classes and tests take no time to explain the utility of a tool which was created to solve problems and model things.
comment 3y ago · link · parent
Yes, this is how democracy works in general. You don't get everything (or necessarily anything) you want
Personally the only thing that would really make me quit is if they tried to make me go hybrid or back to the office in any way. My workplace is small (10 engineers) and so unionizing based on that could be pretty easy, but it would be easier for me to quit and find a new job that does do remote
comment 3y ago · link · parent
comment 3y ago · link · parent
I think Facepunch is one of the indie studios uniquely poised to do this. Garry spent years working on modding the source engine, adding features to the point where it's like a new engine on top of the source renderer
comment 3y ago · link · parent
comment 3y ago · link · parent
Pinochet goes into a bucket of other dictators like himself, such as Park Chung Hee and Lee Kwon Yu, who ruthlessly cracked down on political opposition (particularly leftists), but who modernized their respective economies and (in the case of Pinochet) brought them back from the brink of utter economic collapse. These figures remain controversial in their home countries because they were a double-edged sword: the economic advancement which benefitted everyone was paid for with blood
Today, the US Left remembers this as beginning a period of neoliberalism (Chicago school economics) in much of the developing world which had just begun to set its ambitions much higher than they could reasonably afford. They consider this to be a bad thing because they didn't live through the period of the 1970s in which expanded fiscal and irresponsible monetary policy allowed inflation to rise and governments to explode their debt/gdp ratio, with disastrous results