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
from phBot import * | |
import QtBind | |
import ssl | |
import os | |
import json | |
import socket | |
import time | |
from threading import Thread | |
from urllib.parse import urlparse |
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 findDuplicatedObjectKeyValues = require('./cu.js') | |
describe('Cu', () => { | |
it('should meu pau', () => { | |
const keys = findDuplicatedObjectKeyValues({ | |
a: 1, | |
b: 2, | |
c: 3, | |
d: 4, | |
e: 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
const findDuplicatedObjectKeyValues = (obj) => { | |
const propertyKeys = Object.keys(obj) | |
return propertyKeys.reduce((state, propertyKey, index) => { | |
const propertyValue = obj[propertyKey] | |
if (state.propertyValues.includes(propertyValue)) { | |
state.duplicatedValueKeys = [...state.duplicatedValueKeys, propertyKey] | |
} | |
state.propertyValues = [...state.propertyValues, propertyValue] | |
if (index === propertyKeys.length - 1) return state.duplicatedValueKeys | |
return state |
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 java.util.* | |
inline fun <reified T> prompt(text: String): T { | |
return prompt(text, null) | |
} | |
inline fun <reified T> prompt(text: String, default: T?): T { | |
return when (T::class) { | |
String::class -> promptString(text, default as String) as T | |
Int::class -> promptInt(text, default as Int) as T |
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
// Paste it in the console of tinder.com | |
const randomInteger = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min | |
let likesGiven = 0 | |
const like = () => { | |
const likeBtn = Array.from(document.querySelectorAll('span')).find(el => el.textContent === 'Like') | |
if (likeBtn) likeBtn.click() | |
likesGiven++ | |
document.title = `Liked ${likesGiven} times` |
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 { Polly } = require('@pollyjs/core'); | |
const PuppeteerAdapter = require('@pollyjs/adapter-puppeteer'); | |
// const FSPersister = require('@pollyjs/persister-fs'); | |
const puppeteer = require('puppeteer'); | |
Polly.register(PuppeteerAdapter); | |
// Polly.register(FSPersister); | |
(async () => { | |
try { |
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/bash | |
sudo apt install ksshaskpass -y | |
ssh_keys=$(find "${HOME}/.ssh" -type f ! -name "*.*" | tr '\n' ' ') | |
ssh_unlock_script_path="${HOME}/.config/autostart-scripts/ssh-unlock.sh" | |
rm -rf "${ssh_unlock_script_path}" | |
echo "#!/bin/bash |
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 (window, angular, $) { | |
var root = angular.element(document.getElementsByTagName('body')); | |
/** | |
* Finds watchers attached for the element. | |
* | |
* @param {Object} element Html element to look for watchers | |
* @return {Object[]} | |
*/ | |
var _findWatchers = function (element) { |
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 promises = require('./promises'); | |
/** Retrieve data */ | |
async function getInfo() { | |
const country = await promises.getCountry(); | |
const time = await promises.getTime(); | |
const weather = await promises.getWeather(); | |
return { country, time, weather }; |
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 Promise = require('bluebird'); | |
const list = [1, 2, 3, 4]; | |
function multiplyBy2(x) { | |
return Promise.resolve(x * 2); | |
} | |
Promise.all(list.map(multiplyBy2)) | |
.then(console.log); |