Skip to content

Instantly share code, notes, and snippets.

View VladimirCores's full-sized avatar
💭
evolve

Vladimir Minkin VladimirCores

💭
evolve
View GitHub Profile
@VladimirCores
VladimirCores / dhcpd.conf
Created February 18, 2023 20:21
Connect and bridge internet through ethernet
# 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;
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
@VladimirCores
VladimirCores / future_extension.dart
Created May 6, 2022 14:29 — forked from VB10/future_extension.dart
Future Extension Flutter
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());
@VladimirCores
VladimirCores / gist:27c6cbd4d1d14ffed858ffb8317f48ad
Created March 8, 2021 14:55
node --help --v8-options > info
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.
@VladimirCores
VladimirCores / install-docker.sh
Created January 31, 2021 11:20 — forked from madkoding/install-docker-deepin.sh
Install Docker-CE script for Deepin Linux
#!/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
@VladimirCores
VladimirCores / pc.laptop
Created January 28, 2021 16:55 — forked from jonschoning/pc.laptop
/usr/share/X11/xkb/symbols/pc (swap CTRL+ALT+CAPS; ALT->CTRL, CAPS->ALT) https://github.com/jonschoning/xkb_symbols
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 ] };
@VladimirCores
VladimirCores / gist:15eb68b7f6b741cd5ead9f47517dbf73
Created November 21, 2020 09:29
String value type and String object type
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('======================')
Add to ~/.bash_profile:
function killOnTCPPort () {
kill -QUIT $(sudo lsof -sTCP:LISTEN -i tcp:$1 -t)
}
Then source ~/.bash_profile and run
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])
/*
* 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([]))