Given array a
, count occurrences and stack.
e.g. a = np.array([0, 0, 1, 1, 2, 1, 0, 2, 3, 0, 1])
then counts = np.dstack(np.unique(a, return_counts=True))
gives
array([[[0, 4],
[1, 4],
[2, 2],
Given array a
, count occurrences and stack.
e.g. a = np.array([0, 0, 1, 1, 2, 1, 0, 2, 3, 0, 1])
then counts = np.dstack(np.unique(a, return_counts=True))
gives
array([[[0, 4],
[1, 4],
[2, 2],
Okay, the title of this post is a bit of a lie. There's no one secret trick to becoming a genius programmer - there are two, and they're more habits than tricks. Nevertheless, these kind of 'secret tricks' seem to resonate with people, so I went for this title anyway.
Every once in a while, a somewhat strange thing happens to me. I'll be helping somebody out on IRC - usually a beginner - answering a number of their questions in rapid succession, about a variety of topics. Then after a while, they call me a "genius" for being able to answer everything they're asking; either directly, or while talking about me to somebody else.
Now, I don't really agree with this "genius" characterization, and it can make me feel a bit awkward, but it shows that a lot of developers have a somewhat idealistic and nebulous notion of the "genius programmer" - the programmer that knows everything, who can do everything, who's never stumped by a problem, and of which ther
import hashlib as hasher | |
import datetime as date | |
# Define what a Snakecoin block is | |
class Block: | |
def __init__(self, index, timestamp, data, previous_hash): | |
self.index = index | |
self.timestamp = timestamp | |
self.data = data | |
self.previous_hash = previous_hash |
Hacknet.HackerScriptExecuter.runScript("HackerScripts/Script.txt", os);
// This implies that you're running this in a Pathfinder command.
// If not, you'll have to replace `os` with an instance of the players os
// somehow.
Default scripts are ThemeHack.txt
(Naix's theme deleter) and SystemHack.txt
(Striker's VMBootloaderTrap)
To use your own script, create one using the documentation below and then add it to the Content/HackerScripts
folder in your Hacknet installation path.
SPC s c remove highlight | |
**** Files manipulations key bindings | |
Files manipulation commands (start with ~f~): | |
| Key Binding | Description | | |
|-------------+----------------------------------------------------------------| | |
| ~SPC f c~ | copy current file to a different location | | |
| ~SPC f C d~ | convert file from unix to dos encoding | | |
| ~SPC f C u~ | convert file from dos to unix encoding | |
It has been a long time since I finish(nearly) these problems...
In linux, 0
is std_input, 1
is std_output, 2
is std_error_output.
We just need to send LETMEWIN
to std_input and set fd to 0
which means (our input - 0x1234) == 0.
This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet
SPC q q
- quitSPC w /
- split window verticallySPC w
- - split window horizontallySPC 1
- switch to window 1SPC 2
- switch to window 2SPC w c
- delete current window% -*- mode: Prolog -*- | |
% (c) J. R. Fisher. | |
% http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_17.html | |
% Animal identification rules | |
% To run, type go. | |
go :- hypothesize(Animal), | |
write('I guess that the animal is: '), |