Skip to content

Instantly share code, notes, and snippets.

View berdosi's full-sized avatar

Bálint Erdősi berdosi

View GitHub Profile
CmdUtils.CreateCommand({
name: "richtypo",
author: { name: "Balint Erdosi" },
license: "GPL",
description: "Tipo- és ortográfiai korrekciókat végez a textareában kiválasztott szövegen",
takes: {"input": noun_arb_text},
execute: function richTypo(input) {
var str = input.html
.replace(/\.\.\./g,'…')
.replace(/--/g,'–')
/*
* Do not remove the @namespace line -- it's required for correct functioning
*/
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
/* a menü jobb szélére pakolom a menüt, és felhúzom oda a toolbar nagy részét. A menü csak akkor lesz teljes méretű, ha az egér fölé ér. TinyMenu extension helyett :) */
menubar {
width: 24px;
overflow: hidden;
}
#!/bin/bash
BELEPES_USERNAME=töltsd_ki
BELEPES_JELSZO=ezt_is
TEMPFILE=`tempfile`
HREF=`curl -isL -c $TEMPFILE www.tvn.hu | grep Location | sed -e "s#.*\(http://.*\)index.tvn#\1iranymondo.tvn#" | tail -n 1`
POSTDATA="belepes_username=${BELEPES_USERNAME}&belepes_jelszo=${BELEPES_JELSZO}&js_autodetect_results=0&just_logged_in=1&varas=tvn.hu&gokep.x=29&gokep.y=8"
curl -sL -b $TEMPFILE -c $TEMPFILE -d $POSTDATA $HREF
rm $TEMPFILE
#!/bin/bash
OUTFILE="$1.pau"
echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--This is a lesson file for Pauker (http://pauker.sourceforge.net)-->
<Lesson LessonFormat="1.7">
<Description/>
<Batch>' > $OUTFILE
sed $1 -e 's#\(.*\)\t\(.*\)# <Card>\n <FrontSide Orientation="LTR" RepeatByTyping="false">\n <Text>\1</Text>\n </FrontSide>\n <ReverseSide Orientation="LTR" RepeatByTyping="false">\n <Text>\2</Text>\n </ReverseSide>\n </Card>#' >> $OUTFILE
echo ' </Batch>
<Batch/>
function* fibonacci() { var act = 1, prev = 1; while (true) { t = act; yield act = (act + prev); prev = t } }
// not the primes, but binary according to primality
function* primes(){ var n = 2; while(true) {for(var i=2;i<=Math.sqrt(n);i++) if (0==n%i) yield false, ++n; yield true, ++n} }
/* code based on pseudocode from https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm#Calculating_distance */
interface replacePair {
first: string;
second: string;
cost: number
}
class replacePairCollection {
replacePairs: Array<replacePair>;
@berdosi
berdosi / License for my Gists
Last active November 30, 2016 00:10
This license applies for all my public gists under gist.github.com/numen/
MIT License
Copyright (c) 2009-2016, Bálint Erdősi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@berdosi
berdosi / nevnap.sh
Created February 17, 2017 20:46
Shell script to display the current name day
#!/bin/bash
# list from https://hu.wikipedia.org/wiki/Magyar_n%C3%A9vnapok_list%C3%A1ja_d%C3%A1tum_szerint
echo $(grep `date +%m/%d` $0) napja van
exit
01/01 Alpár Fruzsina Bazil
01/02 Ábel Gergely Vazul
01/03 Genovéva Gyöngyvér Benjámin Dzsenifer ((Jennifer))
01/04 Titusz Leona Angéla
01/05 Simon Emília
01/06 Gáspár Menyhért Boldizsár
@berdosi
berdosi / wordfrequency.sh
Last active December 2, 2017 19:32
List the words from a handful of HTML files by frequency.
cat *.html | sed -e 's/<[^>]\+>//g' -e 's/[ \t]\+/\n/g' -e 's/[-\.\\(\\):,;0-9+|]//g'|sort | uniq -ci | sort -h
cat *.html | \ # all the files' contents
sed -e 's/<[^>]\+>//g' \ # without tags (assumes they don't contain line breaks)
-e 's/[ \t]\+/\n/g' \ # replace tabs and spaces with line breaks
-e 's/[^a-z]//gi' | \ # remove some non-letters (
sort | \ # sort once to make uniq work
uniq -ci | \ # show occurrence counts, case insensitive
sort -h # sort by numbers
@berdosi
berdosi / GetBamoszData.js
Created March 25, 2018 22:48
get data from bamosz.hu
const rq = require("http");
const url = "http://www.bamosz.hu/alapoldal?isin=HU0000711353";
const htmlParser = require("htmlparser");
const parseHtml = function(html) {
return new Promise((resolve, reject) => {
(new htmlParser.Parser(
new htmlParser.DefaultHandler(
(error, dom) => {