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
# Useful to prevent Macbooks to go to sleep when closing the lid instead of running tools that requires a Kernel Extension (e.g. InsomniaX) and more | |
# Before doing anything, save your current configuration using | |
pmset -g | |
# To disable sleep | |
sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a disablesleep 1; | |
# And to go back to normal | |
sudo pmset -a sleep 1; sudo pmset -a hibernatemode [original hibernatemode value]; sudo pmset -a disablesleep 0; |
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
Button btnFacebook = findViewById(R.id.btn_facebook); | |
Drawable leftDrawable = AppCompatResources.getDrawable(this, R.drawable.baseline_power_settings_new_black_18dp); | |
btnFacebook.setCompoundDrawablesWithIntrinsicBounds(leftDrawable, null, null, null); | |
// Start Facebook integration | |
LoginManager fbLoginManager = com.facebook.login.LoginManager.getInstance(); | |
mCallbackManager = CallbackManager.Factory.create(); | |
fbLoginManager.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() { | |
@Override |
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
/* | |
* Author: http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/ | |
*/ | |
/* Smartphones (portrait and landscape) ----------- */ | |
@media only screen | |
and (min-device-width : 320px) | |
and (max-device-width : 480px) { | |
/* Styles */ | |
} |
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
#AND | |
<b:if cond='data:blog.pageType == "index"'> | |
<b:if cond='data:blog.searchQuery'> | |
<!--search_page AND index_page--> | |
</b:if> | |
</b:if> | |
#OR |
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
<select id="country" name="country" class="full-width" selected="" data-init-plugin="select2"> | |
<option value="AF">Afghanistan</option> | |
<option value="AX">Åland Islands</option> | |
<option value="AL">Albania</option> | |
<option value="DZ">Algeria</option> | |
<option value="AS">American Samoa</option> | |
<option value="AD">Andorra</option> | |
<option value="AO">Angola</option> | |
<option value="AI">Anguilla</option> | |
<option value="AQ">Antarctica</option> |
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
Format: ssh -i <path-to-private-key> <link-local-ip> -p 3922 | |
Example: root@faith:~# ssh -i /root/.ssh/id_rsa.cloud 169.254.3.93 -p 3922 |
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
+---------------- minute (0 - 59) | |
| +------------- hour (0 - 23) | |
| | +---------- day of month (1 - 31) | |
| | | +------- month (1 - 12) | |
| | | | +---- day of week (0 - 6) (Sunday=0 or 7) | |
| | | | | | |
* * * * * command to be executed |
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
#include <stdio.h> | |
#include <cstdlib> | |
#define CLEAR "\x1b[2J" // clear | |
#define RESET "\x1b[0m" // reset color style | |
#define BLACK "\x1b[30m" /* Black */ | |
#define RED "\x1b[31m" /* Red */ | |
#define GREEN "\x1b[32m" /* Green */ | |
#define YELLOW "\x1b[33m" /* Yellow */ |
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
#include <getopt.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define OPT1 "Operation1" | |
#define OPT2 "Operation2" | |
struct global_args_t { | |
const char *program_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
#include <stdio.h> | |
#include <cstdlib> | |
#define PROGRESS_BAR_STR "=================================" | |
#define PROGRESS_BAR_WIDTH sizeof(PROGRESS_BAR_STR) | |
void print_progress_bar(size_t completed, size_t total) { | |
const char operation[] = "Downloaded"; | |
const char prefix[] = " kMGT"; |