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
# https://www.linuxfordevices.com/tutorials/ubuntu/dhcp-server-on-ubuntu | |
# The default lease time for a client is 10 mins(600 seconds) | |
# and the maximum lease time is 2 hrs(7200 seconds). | |
default-lease-time 600; | |
max-lease-time 7200; | |
authoritative; |
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
What worked for me was setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,ru | |
You need to create a file /etc/X11/xorg.conf.d/00-keyboard.conf for this you can use this command: | |
localectl --no-convert set-x11-keymap us,ru grp:switch,grp:alt_shift_toggle,grp_led:scroll | |
If you wanted to enable the Ctrl+Alt+Backspace sequence to kill the X server by default | |
setxkbmap -option "terminate:ctrl_alt_bksp" | |
localectl --no-convert set-x11-keymap us,ru grp:switch,grp:alt_shift_toggle,grp_led:scroll,terminate:ctrl_alt_bksp |
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
extension FutureExtension on Future { | |
Widget toBuild<T>({Widget Function(T data) onSuccess, Widget onError, dynamic data}) { | |
return FutureBuilder<T>( | |
future: this, | |
initialData: data, | |
builder: (BuildContext context, AsyncSnapshot snapshot) { | |
switch (snapshot.connectionState) { | |
case ConnectionState.waiting: | |
case ConnectionState.active: | |
return Center(child: CircularProgressIndicator()); |
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
SSE3=1 SSSE3=1 SSE4_1=1 SSE4_2=1 SAHF=1 AVX=1 FMA3=1 BMI1=1 BMI2=1 LZCNT=1 POPCNT=1 ATOM=0 | |
Synopsis: | |
shell [options] [--shell] [<file>...] | |
d8 [options] [-e <string>] [--shell] [[--module] <file>...] | |
-e execute a string in V8 | |
--shell run an interactive JavaScript shell | |
--module execute a file as a JavaScript module | |
Note: the --module option is implicitly enabled for *.mjs files. |
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
#!/bin/sh | |
# Shell script to add docker-ce to Deepin Linux repositories | |
# Remove old docker | |
sudo apt-get remove -y docker docker-engine docker.io containerd runc | |
# Install dependencies | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common | |
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
default partial alphanumeric_keys modifier_keys | |
xkb_symbols "pc105" { | |
key <ESC> { [ Escape ] }; | |
// The extra key on many European keyboards: | |
key <LSGT> { [ less, greater, bar, brokenbar ] }; | |
// The following keys are common to all layouts. | |
key <BKSL> { [ backslash, bar ] }; |
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
let st1 = new String('NAME') | |
let st2 = st1 | |
let st3 = 'NAME' | |
console.log('st1 === st2 ->', st1 === st2) | |
console.log('st1 == st2 ->', st1 == st2) | |
console.log('st1 === st3 ->', st1 === st3) | |
console.log('st1 == st3 ->', st1 == st3) | |
console.log('st2 === st3 ->', st2 === st3) | |
console.log('st2 == st3 ->', st2 == st3) | |
console.log('======================') |
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 to ~/.bash_profile: | |
function killOnTCPPort () { | |
kill -QUIT $(sudo lsof -sTCP:LISTEN -i tcp:$1 -t) | |
} | |
Then source ~/.bash_profile and run |
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 BRACKETS = ['{', '}', '(', ')', '[', ']'] | |
let isValidByCount = (str) => { | |
let bracketPosition = 0 | |
let bracketsAmountPerType = new Array(BRACKETS.length).fill(0) | |
for (let char of str) { | |
bracketPosition = BRACKETS.indexOf(char) | |
if (bracketPosition > -1) bracketsAmountPerType[bracketPosition] += 1 | |
} | |
for (let i = 0; i < BRACKETS.length; i+=2) | |
if (bracketsAmountPerType[i] !== bracketsAmountPerType[i+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
/* | |
* serial executes Promises sequentially. | |
* @param {funcs} An array of funcs that return promises. | |
* @example | |
* const urls = ['/url1', '/url2', '/url3'] | |
* serial(urls.map(url => () => $.ajax(url))) | |
* .then(console.log.bind(console)) | |
*/ | |
export const sequence = funcs => funcs.reduce((acc, b) => acc.then((f => x => f().then((list => Array.prototype.concat.bind(list))(x)))(b)), Promise.resolve([])) |
NewerOlder