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
var fs = require('fs'); | |
var walk = function(dir, done) { | |
var results = []; | |
fs.readdir(dir, function(err, list) { | |
if (err) return done(err); | |
var i = 0; | |
(function next() { | |
var file = list[i++]; | |
if (!file) return done(null, results); | |
file = dir + '/' + file; |
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
var fs = require('fs'); | |
var path = require('path'); | |
var walk = function(dir, done) { | |
var results = []; | |
fs.readdir(dir, function(err, list) { | |
if (err) return done(err); | |
var pending = list.length; | |
if (!pending) return done(null, results); | |
list.forEach(function(file) { | |
file = path.resolve(dir, file); |
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
const MongoClient = require('mongodb').MongoClient; | |
const url = "mongodb://mongo:27017/mydb"; | |
const query = { address: "Highway 37" }; | |
const myDoc = { name: "Company Inc", address: "Highway 37" }; | |
const p = new Promise((resolve, reject) => { | |
MongoClient.connect(url, (err, db) => { | |
if (err) reject(err); | |
console.log("Database created!"); | |
resolve(db); |
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
#!/bin/bash | |
#ref https://forums.linuxmint.com/viewtopic.php?t=250829 | |
echo "deb https://linuxmint.com.ru/repo/xenial/ /" | sudo tee -a /etc/apt/sources.list | |
wget --quiet https://linuxmint.com.ru/repo/xenial/lmcomru-pubkey; sudo apt-key add lmcomru-pubkey | |
sudo apt update | |
sudo apt install xserver-xorg-core=2:1.17.3-2ubuntu4 xserver-common=2:1.17.3-2ubuntu4 xserver-xorg-input-evdev=1:2.9.2-1ubuntu1 xserver-xorg-input-synaptics=1.8.2-1ubuntu2 xserver-xorg-input-vmmouse=1:13.1.0-1ubuntu1 xserver-xorg-input-wacom=1:0.32.0-0ubuntu2 xserver-xorg-video-intel=2:2.99.917+git20160218-1ubuntu2 xserver-xorg-video-radeon=1:7.6.1-1ubuntu1 | |
sudo apt install fglrx fglrx-dev fglrx-core fglrx-amdcccle | |
sudo aticonfig --initial | |
sudo apt hold xserver-xorg-core xserver-common fglrx-core |
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
docker images --format "{{.Repository}}:{{.Tag}}" | grep :latest | xargs -L1 docker pull |
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
function getParameterByName(name, url) { | |
if (!url) url = window.location.href; | |
name = name.replace(/[\[\]]/g, "\\$&"); | |
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | |
results = regex.exec(url); | |
if (!results) return null; | |
if (!results[2]) return ''; | |
return decodeURIComponent(results[2].replace(/\+/g, " ")); | |
} |
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
find ./ -name $'*\n*' -exec rename 's/\n/ /g' {} \; |
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
inject(mixin) { | |
if (Array.isArray(mixin)) { | |
for(let i in mixin) { | |
this.inject(mixin[i]); | |
} | |
return; | |
} else if ('object' !== typeof mixin) { | |
throw Error('Invalid mixin'); | |
} |
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
-- Don't forget chech base_product at wp_postmeta | |
DELETE FROM dest_db.wp_terms | |
WHERE exists(SELECT * FROM dest_db.wp_term_taxonomy | |
WHERE taxonomy='wpc-template-cat' AND wp_term_taxonomy.term_id=wp_terms.term_id); | |
DELETE FROM dest_db.wp_term_relationships | |
WHERE term_taxonomy_id IN (SELECT wp_term_taxonomy.term_taxonomy_id FROM dest_db.wp_term_taxonomy | |
WHERE taxonomy='wpc-template-cat'); | |
DELETE FROM dest_db.wp_term_taxonomy |
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
DELETE | |
FROM `wp_options` | |
WHERE option_name like '_transient_geoip%'; | |
DELETE | |
FROM `wp_options` | |
WHERE option_name LIKE '_transient_timeout_geoi%'; | |
DELETE | |
FROM `wp_options` |