Skip to content

Instantly share code, notes, and snippets.

View rodrigogs's full-sized avatar
🏠
Working from home

Rodrigo Gomes da Silva rodrigogs

🏠
Working from home
  • 20:18 (UTC -03:00)
View GitHub Profile
@rodrigogs
rodrigogs / novinha.py
Last active April 15, 2024 15:13
Novinha Drops Plugin
from phBot import *
import QtBind
import ssl
import os
import json
import socket
import time
from threading import Thread
from urllib.parse import urlparse
const findDuplicatedObjectKeyValues = require('./cu.js')
describe('Cu', () => {
it('should meu pau', () => {
const keys = findDuplicatedObjectKeyValues({
a: 1,
b: 2,
c: 3,
d: 4,
e: 1,
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
@rodrigogs
rodrigogs / Cli.kt
Last active October 22, 2021 19:09
Kotlin simple terminal CLI
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
@rodrigogs
rodrigogs / tinder-bot.js
Last active August 27, 2022 00:20
Tinder bot for browser
// 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`
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 {
@rodrigogs
rodrigogs / kde-ssh-autostart-setup.sh
Created September 17, 2019 19:55
Setup the KDE environment to automatically initialize the ssh agent and load the keys from .ssh.
#!/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
@rodrigogs
rodrigogs / ng-blame.js
Created July 20, 2017 17:50
Trace Angular watchers visually
(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) {
@rodrigogs
rodrigogs / async-functions.js
Created April 27, 2017 16:25
Working with JavaScript async functions
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 };
@rodrigogs
rodrigogs / processListUsingPromises.js
Created January 10, 2017 19:45
Processing list using promises
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);