This file contains hidden or 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
Login as root to your Linux server using key based authentication. Use an editor like Nano or Vim to edit the following file: | |
/etc/ssh/sshd_config | |
Find the following line: | |
PasswordAuthentication yes | |
And change it to: | |
PasswordAuthentication no | |
If there is a # (means commented out) at the beginning of that line, remove it. |
This file contains hidden or 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
<head> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
</head> |
This file contains hidden or 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
import Vue from 'vue'; | |
const Api = require('./api/); | |
document.addEventListener("DOMContentLoaded", () => { | |
var app = new Vue({ | |
el: '#app', | |
components: { | |
'task': { |
This file contains hidden or 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
unsigned int b = 8; // can't represent negative numbers | |
int a = 7; | |
This file contains hidden or 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
for blah in 'Zero to Mastery': | |
print(blah) | |
#output | |
Z | |
e | |
r | |
o | |
t |
This file contains hidden or 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
UIAlertController * alert= [UIAlertController | |
alertControllerWithTitle:@"Title" | |
message:[NSString stringWithFormat:@"Message"] | |
preferredStyle:UIAlertControllerStyleAlert]; | |
UIAlertAction* okButton = [UIAlertAction | |
actionWithTitle:@"OK" | |
style:UIAlertActionStyleDefault | |
handler:^(UIAlertAction * action) | |
{ |
This file contains hidden or 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
# map(action, [1,2,3]) | |
def multiply_by2(item): | |
return item*2 | |
print(list(map(multiply_by2, [1,2,3]))) | |
my_pets = ['sisi', 'bibi', 'titi', 'carla'] | |
def capatilze(name): |
This file contains hidden or 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
Whereas a class needs to explicitly identify the type, a templated function does not need to explicitly identify the type(s) used if the type of its arguments can be sufficiently matched to the templated types used in the function declaration. | |
std::vector<char> | |
std::vector<int> | |
std::vector<uiuc::Cube> | |
vectors are part of the standard library for arrays | |
defined in: #include <vector> | |
initialization: std::vector<Type> v; |
This file contains hidden or 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
config.action_controller.allow_forgery_protection = false | |
config.action_mailer.default_url_options = { :host => 'DOMAIN.COM' } | |
config.action_mailer.perform_deliveries = true | |
config.action_mailer.delivery_method = :smtp | |
config.action_mailer.smtp_settings = { | |
:enable_starttls_auto => true, | |
:address => "smtp.gmail.com", | |
:port => 587, | |
:domain => "gmail.com", | |
:authentication => :login, |
This file contains hidden or 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
[Boolean-valued condition] ? [expression to evaluate if true] : [expression to evaluate if false] | |
So, you could compare "A ? B : C" to "if (A) {B;} else {C;}" but that the ternary operator is allowed in situations where "if" is not allowed. This is because "?:" is evaluated at the level of an expression, so it can be a sub-expression within a larger expression, whereas the "if" statement is a top-level flow control statement that can't be nested within an expression. This means that you can put ?: to the right of an assignment = operator, which you cannot do with an "if". Here is an example: | |
// Since (5<10) is true, the expression before the colon will be selected, which is 1. | |
int x = 5 < 10 ? 1 : 2; | |
// Now x is equal to 1. | |
// Note, the following syntax is NOT allowed in C++, which is why the ternary operator can be useful in these cases: | |
int y = if (5<10) {1;} else {2;} |