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
1 sudo nano /etc/default/grub | |
2 There is a line in that: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" (like this), replace with: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_idle.max_cstate=1" | |
3 Save it (CTRL+O) | |
4 sudo update-grub | |
5 sudo reboot | |
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
func makeSchemaValues(Types interface{}) (graphql.Fields, graphql.FieldConfigArgument) { | |
fields := make(graphql.Fields) | |
args := make(graphql.FieldConfigArgument) | |
val := reflect.ValueOf(Types) | |
if val.Kind() == reflect.Ptr { | |
val = reflect.Indirect(val) |
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
package main | |
import ( | |
"bytes" | |
"context" | |
"encoding/json" | |
"fmt" | |
"log" | |
"math/rand" | |
"strings" |
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
Thanks to ///https://medium.com/@ryardley/react-hooks-not-magic-just-arrays-cd4f1857236e | |
let state = []; | |
let setters = []; | |
let firstRun = true; | |
let cursor = 0; | |
function createSetter(cursor) { | |
return function setterWithCursor(newVal) { | |
state[cursor] = newVal; |
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
/* | |
write a function that takes two inputs: | |
vocabulary - array of strings (words) | |
sentence - string | |
and returns: | |
true - if the sentence can be split in the words given; words can be repeated, words can have any order; you can use only subset of words | |
false - if the sentence cannot be split in the words |
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
### Add security rule for public access | |
service firebase.storage { | |
match /b/{bucket}/o { | |
match /{allPaths=**} { | |
allow read, write; | |
} | |
} | |
} |
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
const emails = "[email protected]" | |
const msg = `<p><span>msg:${req.body.msg}</span> <br /> <span>url:${req.body.url}</span> <br /> <span>line:${req.body.lineNo}</span> <br /> <span>column:${req.body.columnNo}</span> <br /> error:${req.body.error}</p>`; | |
exec.exec(`echo "From:[email protected]\r\nDate: $(date)\r\nSubject:website crash report\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=utf-8\r\n\r\n ${msg}" | sudo ssmtp -vvv -C ssmpt2.conf -ap 55604881 -F " Pro error" ${emails}`, (err, stdout, stderr) => { | |
if (err) {return;} | |
}); |
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
struct Moose { | |
name: String | |
} | |
struct Deer { | |
name: String | |
} | |
trait Actions { | |
fn baby_name(&self) -> String; |
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
extern crate rand; | |
use rand::prelude::*; | |
use std::collections::HashMap; | |
use std::io::{stdin, stdout, Write}; | |
fn main() { | |
let mut game_values: HashMap<&str, i32> = HashMap::new(); | |
game_values.insert("kivi", 1); |
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 svg <svg class="twitter-icon"> | |
<use xlink:href="path/to/icons.svg#twitter-icon"></use> | |
<svg> |