Skip to content

Instantly share code, notes, and snippets.

View jozefchmelar's full-sized avatar
💭
writing bugs, fixing code

Jokinko jozefchmelar

💭
writing bugs, fixing code
View GitHub Profile
@jozefchmelar
jozefchmelar / o2 internet prague praha.md
Created June 28, 2023 14:04
O2 Internet v Prahe - vlastny router. | O2 Internet in Prague with your own router.

AT YOUR OWN RISK

Do NOT accept O2 router.

  • O2 will try to tell you need it. You probably don't.
  • Under no circumstances allow the technician to open, unwrap the o2 router.
  • Tell him to NOT install it. The technician is not allowed to take it back.
  • DO NOT UNWRAP IT !
  • Take it to the O2 store - they accepted mine on Florenc.
  • Make sure they will not charge you for it.

Buy a different router

@jozefchmelar
jozefchmelar / change ams id on tcbsd.md
Last active January 12, 2022 14:32
Change AMS ID on TcBSD TwinCAT/BSD

Change AMS ID on TcBSD TwinCAT/BSD

Login to your TcBSD and type following

cat /usr/local/etc/TwinCAT/3.1/TcRegistry.xml

Note : be careful when copying commands from the internet!

You should see something like this. We will change the AmsId property

@jozefchmelar
jozefchmelar / docker
Created February 21, 2021 12:27
reverse proxy nginx jupyter lab notebook
## Based on: https://github.com/calpolydatascience/jupyterhub-deploy-data301/blob/master/roles/nginx/templates/nginx.conf.j2
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
@jozefchmelar
jozefchmelar / CompileAst.cs
Created November 21, 2019 18:28
This code will traverse AST
var root = parseTree.Root.AstNode as BaseAst;
var visitor = new HtmlConcreteVisitor(new StringBuilder());
root.AcceptVisitor(visitor);
@jozefchmelar
jozefchmelar / PlainTextAst.cs
Last active November 21, 2019 18:26
Writing the text
public override void AcceptVisitor(IAstVisitor visitor)
{
if(Parent is RootAst) // in case it's top level we want to have <p> tag, if it's inside <b> tag we dont need it.
visitor.BeginVisit(this);
if(visitor is IAstWriteableVisitor writeableVisitor)
writeableVisitor.Write(Text); /// here you output the text.
if (Parent is RootAst)
visitor.EndVisit(this);
}
@jozefchmelar
jozefchmelar / MyHtmlVisitor.cs
Created November 21, 2019 18:15
HtmlVisitor
public void BeginVisit(IVisitableNode node)
{
var baseAst = (node as BaseAst);
Write(baseAst.StartTag);
}
public void EndVisit(IVisitableNode node)
{
var baseAst = (node as BaseAst);
Write(baseAst.EndTag);
@jozefchmelar
jozefchmelar / IronyVisit.cs
Created November 21, 2019 18:13
IronyVisitor
public virtual void AcceptVisitor(IAstVisitor visitor) {
visitor.BeginVisit(this);
if (ChildNodes.Count > 0)
foreach(AstNode node in ChildNodes)
node.AcceptVisitor(visitor);
visitor.EndVisit(this);
}
//from https://github.com/IronyProject/Irony/blob/06a088e0199c6e67097d72512ad69e2e86f041c2/Irony.Interpreter/Ast/Base/AstNode.cs#L141
@jozefchmelar
jozefchmelar / NonTerminalMd.cs
Created November 21, 2019 15:52
Irony from parse tree to AST
public class NonTerminalMd : NonTerminal
{
public NonTerminalMd(string name, Type nodeType) : base(name, nodeType)
{
AstConfig.DefaultNodeCreator = () => Activator.CreateInstance(nodeType);
}
}
@jozefchmelar
jozefchmelar / rename.sh
Created April 1, 2019 16:24
renames all string occurences in directory and subdir
find ./ -type f -readable -writable -exec sed -i "s/OLD_STRING/NEW_STRING/g" {} \;
@jozefchmelar
jozefchmelar / resolution.sh
Created March 28, 2019 15:21
sets virtual box resolution for 2560x1440
xrandr --newmode "2560x1440_60.00" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync
xrandr --addmode Virtual1 "2560x1440_60.00"
xrandr --output Virtual1 --mode "2560x1440_60.00"