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
rm -rf /Applications/Tuxera\ Disk\ Manager.app | |
rm -rf /Library/Application\ Support/Tuxera\ NTFS | |
rm -rf /Library/Filesystems/fusefs_txantfs.fs |
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
function tong(a,b){ | |
while(a.length<b.length) a="0"+a; | |
while (a.length >b.length) b = "0" + b; | |
a="0"+a; | |
b="0"+b; | |
var du=0; | |
var c=""; | |
for(var i=a.length-1;i>=0;i--){ | |
c=((Number(a[i])+Number(b[i])+du)%10).toString()+c; | |
du = Math.floor((Number(a[i]) + Number(b[i]) + du) / 10); |
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
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); | |
or just crypto | |
const crypto = require("crypto"); | |
const id = crypto.randomBytes(16).toString("hex"); |
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
function chuan_hoa_xau(str0) { | |
var str = ""; | |
for (let i = 0; i < str0.length; i++) { | |
if ((str0[i] !== `[`) && (str0[i] !== `]`) && (str0[i] !== `;`) | |
&& (str0[i] !== `=`) | |
) str += str0[i]; | |
} | |
str = str.replace(/[&\/\\#,+()$~%.'":*?<>{}]/g, ''); | |
str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a"); | |
str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e"); |
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 z_algo=(s)=>{ | |
let n = s.length; | |
var z = [n]; | |
let l=0,r=0; | |
for (let i = 1; i < n; i++) { | |
if (i > r) { | |
l = r = i; | |
while (r < n && s[r - l] == s[r]) r += 1; | |
z[i] = r - l; | |
r -= 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
function qs(l, r,a) { | |
var i = l; | |
var j = r; | |
var key = a[Math.floor((l + r) / 2)]; | |
do { | |
while (a[i] < key) i++; | |
while (a[j] > key) j--; | |
if (i <= j) { | |
let t = a[i]; | |
a[i] = a[j]; |
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
import axios from 'axios'; | |
export default (base64)=>{ | |
return new Promise(async (solved, reject) => { | |
try { | |
let axiosConfig = { | |
headers: { | |
'Content-Type': 'application/json;charset=UTF-8', | |
'Authorization': 'Client-ID 09731551a5dedbe' | |
} | |
} |
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
function nonAccentVietnamese(str) { | |
str = str.toLowerCase(); | |
// We can also use this instead of from line 11 to line 17 | |
// str = str.replace(/\u00E0|\u00E1|\u1EA1|\u1EA3|\u00E3|\u00E2|\u1EA7|\u1EA5|\u1EAD|\u1EA9|\u1EAB|\u0103|\u1EB1|\u1EAF|\u1EB7|\u1EB3|\u1EB5/g, "a"); | |
// str = str.replace(/\u00E8|\u00E9|\u1EB9|\u1EBB|\u1EBD|\u00EA|\u1EC1|\u1EBF|\u1EC7|\u1EC3|\u1EC5/g, "e"); | |
// str = str.replace(/\u00EC|\u00ED|\u1ECB|\u1EC9|\u0129/g, "i"); | |
// str = str.replace(/\u00F2|\u00F3|\u1ECD|\u1ECF|\u00F5|\u00F4|\u1ED3|\u1ED1|\u1ED9|\u1ED5|\u1ED7|\u01A1|\u1EDD|\u1EDB|\u1EE3|\u1EDF|\u1EE1/g, "o"); | |
// str = str.replace(/\u00F9|\u00FA|\u1EE5|\u1EE7|\u0169|\u01B0|\u1EEB|\u1EE9|\u1EF1|\u1EED|\u1EEF/g, "u"); | |
// str = str.replace(/\u1EF3|\u00FD|\u1EF5|\u1EF7|\u1EF9/g, "y"); | |
// str = str.replace(/\u0111/g, "d"); |
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 nonAccentVietnamese=(str)=>{ | |
str = str.toLowerCase(); | |
// We can also use this instead of from line 11 to line 17 | |
// str = str.replace(/\u00E0|\u00E1|\u1EA1|\u1EA3|\u00E3|\u00E2|\u1EA7|\u1EA5|\u1EAD|\u1EA9|\u1EAB|\u0103|\u1EB1|\u1EAF|\u1EB7|\u1EB3|\u1EB5/g, "a"); | |
// str = str.replace(/\u00E8|\u00E9|\u1EB9|\u1EBB|\u1EBD|\u00EA|\u1EC1|\u1EBF|\u1EC7|\u1EC3|\u1EC5/g, "e"); | |
// str = str.replace(/\u00EC|\u00ED|\u1ECB|\u1EC9|\u0129/g, "i"); | |
// str = str.replace(/\u00F2|\u00F3|\u1ECD|\u1ECF|\u00F5|\u00F4|\u1ED3|\u1ED1|\u1ED9|\u1ED5|\u1ED7|\u01A1|\u1EDD|\u1EDB|\u1EE3|\u1EDF|\u1EE1/g, "o"); | |
// str = str.replace(/\u00F9|\u00FA|\u1EE5|\u1EE7|\u0169|\u01B0|\u1EEB|\u1EE9|\u1EF1|\u1EED|\u1EEF/g, "u"); | |
// str = str.replace(/\u1EF3|\u00FD|\u1EF5|\u1EF7|\u1EF9/g, "y"); | |
// str = str.replace(/\u0111/g, "d"); |
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
io.of('/ggseach').on('connection', function (socket) { | |
console.log(`News user connected :${socket.id}`); | |
socket.on('getResult',keyword=>{ | |
axios.get(`http://google.com/complete/search`,{ | |
params:{ | |
hl:'vi', | |
q:keyword, | |
client:'firefox' | |
}, | |
responseType:'arraybuffer' |
OlderNewer