- Semantics:
- assignment:
- When assigning a variable to another name, eg,
a = b
, a new object is created. However, no data is copied due to the [copy-on-modify][ref1]
- When assigning a variable to another name, eg,
- In order to
xor
booleans, usexor(a, b)
. - reminder and quotient
%%
for reminder and%/%
for quotient.
- For accessing
list
insidelist
,[[index]]
must be used. - For returning a vector from a
data.frame
ordata.table
,df[[one_list_index]]
must be used. - slicing:
- assignment:
- Slicing happens when you
[]
a container (vector
,list
, etc) using more than one index, generated byseq
or:
orc()
. The index used can be integers or charaters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
# rowList is a list who the first and last element is 0(which will not be printed) | |
def print_pascal_triangle_row(row): | |
print(" ".join([str(each) for each in row[1 : -1]])) | |
# @parm n denotes how many rows should it print | |
def print_pascal_triangle(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
seq 1 100000000 | parallel -k --pipe "sed 's/[0-9]*/https:\/\/&/'" |
tree
: Display directory and its child dir (can be controlled via-L level
) in tree.
See here
Install putty, and then enter your virtual machine's IP,
then go to Connection->ssh->X11, click Enable X11 forwarding and give the Xauthority file C:\Cygwin64\C:\cygwin64\home\${YOUR_USERNAME_HERE}\.Xauthority
.
Save the session with your favorite name to reuse the session.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssize_t read(int fd, void *buf, size_t count); | |
ssize_t write(int fd, const void *buf, size_t count); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# This short script queries the icecream scheduler to discover what machines are connected, | |
# and sums the maximum job counts for all x86-64 machines. | |
# It can be used in your mozconfig as follows: | |
# mk_add_options MOZ_MAKE_FLAGS="-j$(icecc-jobs)" | |
# if this script is on your PATH, and named icecc-jobs | |
use List::Util qw(sum0); |
/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉
- Generate your SSH keys as per your git provider documentation.
- Add each public SSH keys to your git providers acounts.
- In your
~/.ssh/config
, set each ssh key for each repository as in this exemple:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use core::ffi::c_void; | |
use core::mem::transmute; | |
use core::ptr::null_mut; | |
use core::marker::PhantomData; | |
/// ErasedFnPointer can either points to a free function or associated one that | |
/// `&mut self` | |
struct ErasedFnPointer<'a, T, Ret> { | |
struct_pointer: *mut c_void, | |
fp: *const (), |
OlderNewer