Skip to content

Instantly share code, notes, and snippets.

View pataiadam's full-sized avatar

Patai Adam pataiadam

  • Budapest, Hungary
  • 11:23 (UTC +02:00)
View GitHub Profile
@pataiadam
pataiadam / index.js
Created April 4, 2023 21:20
jolvanezigy gpt bot csokival es adammal
const googleTTS = require("google-tts-api");
let mpv = require('node-mpv');
const play = async (json) => {
let {text} = JSON.parse(json)
// text max length is 200
text = text.substring(0, 199)
const url = googleTTS.getAudioUrl(text, { lang: "hu", slow: false, host: "https://translate.google.com" })
const mpvPlayer = new mpv();
@pataiadam
pataiadam / guru.js
Last active May 4, 2021 12:18
gurushot vote refresher bookmarklet
/**
Converted Bookmarklet (by https://mrcoles.com/bookmarklet):
javascript:(function()%7B(async%20function()%20%7B%24('.expcucc').remove()%3B%24('.c-challenges-item__exposure__meter__arrow').each(function(i)%20%7B%24(this).parent().parent().prepend('%3Cdiv%20class%3D%22expcucc%22%20style%3D%22position%3A%20absolute%3B%20right%3A%200%22%3EFetching...%3C%2Fdiv%3E')%3B%7D)%3B%24('.c-challenges-item__votes__total').each(function()%20%7B%24(this).text('...')%3B%7D)%3B%24('.c-challenges-item__photos__body').each(function(i)%20%7B%24(this).children().each(function(j)%20%7B%24(this).children('.c-challenges-item__photos__photo__votes').text('...')%3B%7D)%3B%7D)%3Bconst%20resp%20%3D%20await%20(await%20fetch('https%3A%2F%2Fgurushots.com%2Frest%2Fget_member_joined_active_challenges'%2C%20%7Bheaders%3A%20%7B'x-api-version'%3A%207%2C'x-env'%3A%20'WEB'%2C'x-requested-with'%3A%20'XMLHttpRequest'%2C'x-token'%3A%20((name)%20%3D%3E%20%7Bvar%20value%20%3D%20%22%3B%20%22%20%2B%20document.cookie%3Bvar%20parts%20%3D%20value.split(
@pataiadam
pataiadam / index.js
Created November 8, 2019 11:45
k means tfidf
const kmeans = require('node-kmeans');
let data = [
{'category': 'szoke' , content: 'ket szoke no beszelget egy masik szoke novel'},
{'category': 'szoke' , content: 'Egy szoke no bemegy az egyetemre'},
{'category': 'szoke' , content: 'Egy szoke no bemegy az boltba'},
{'category': 'allat' , content: 'A kutya elmegy setalni'},
{'category': 'allat' , content: 'A medve meg a roka setal az erdoben'},
{'category': 'allat' , content: 'Ket hernyo hernyoskodik'},
{'category': 'zsido' , content: 'Ket zsido vesz egy hazat es egy autot'},
@pataiadam
pataiadam / ak.md
Created January 9, 2019 10:02
Admin konvenciok

admin konvenciok

  • paginalas prameterek: page ['1'], rowsPerPage ['25'], sortBy ['column'], descending ['false']
  • service elnevezes: list, get, create, update, remove
  • action elnevezes: list, get, create, update, remove
  • list response payloadja: { items: [], totalItems: 0 }
#!/bin/bash
# CREATE DEV ENVIRONMENT
echo "Setup dev env..."
sleep 1
mkdir dev
cd dev
mkdir projects
mkdir utils
cd utils
@pataiadam
pataiadam / gist:f74be581e87953c5a19a2f73166e2535
Last active April 29, 2018 21:44
ubuntu 16.04 1920x1080
xrandr --newmode "1920x1080R"  138.50  1920 1968 2000 2080  1080 1083 1088 1111 +hsync -vsync
xrandr --addmode DP-1-1 1920x1080R
@pataiadam
pataiadam / style.css
Created February 26, 2018 22:17
simple table css
table {
color: #333;
font-family: Helvetica, Arial, sans-serif;
width: 640px;
border-collapse:
collapse; border-spacing: 0;
}
td, th {
border: 1px solid transparent; /* No more visible border */
@pataiadam
pataiadam / docker.md
Created September 28, 2017 20:14
docker and compose

Install Docker CE:

sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
var notExpired = function(contract) {
if ($scope.expiration == $scope.expDates[0]) return true;
var date = new Date(contract.termTo);
//console.log($scope.expiration.substr(0,4)+" "+monthStrToNum($scope.expiration.substr(5,$scope.expiration.length-1)) +" "+(date.getMonth()+1));
for(var year = 100; year<3000; year++) {
if((new Date(contract.termTo)).getFullYear() != year) {
try{
'use strict';
const pg = require('pg');
console.time('time');
var LOCK = `BEGIN; LOCK TABLE processed_files IN ACCESS EXCLUSIVE MODE;`;
var client1 = new pg.Client(`postgres://${process.env.POSTGRES_USER}:${process.env.POSTGRES_PASSWORD}@${process.env.POSTGRES_HOST}:${process.env.POSTGRES_PORT}/${process.env.POSTGRES_DB}`);
var client2 = new pg.Client(`postgres://${process.env.POSTGRES_USER}:${process.env.POSTGRES_PASSWORD}@${process.env.POSTGRES_HOST}:${process.env.POSTGRES_PORT}/${process.env.POSTGRES_DB}`);
client1.connect(function (err) {
console.timeEnd('time');