Skip to content

Instantly share code, notes, and snippets.

View salomvary's full-sized avatar

Márton Salomváry salomvary

View GitHub Profile
@salomvary
salomvary / backup-mysql.yml
Last active February 8, 2024 19:33
GitHub Action for mysqldump
name: backup-mysql
on:
schedule:
# Run at 7:00 UTC every day
- cron: "0 7 * * *"
jobs:
run_mysqldump:
runs-on: ubuntu-latest
steps:
- name: Dump database
@salomvary
salomvary / html5.html
Created November 9, 2011 11:32
minimal html5 boilerplate
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title></title>
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
@salomvary
salomvary / netlify-remove-pretty-urls.markdown
Created December 4, 2023 19:51
Get rid of Netlify "Pretty URLs" when using Jekyll

Disable Netlify's Pretty URLs feature and add redirects to avoid breaking links to your site.

Followup to my rant on Twitter.

  1. Turn off Pretty URLs on Netlify under Siteconfiguration > Build & deploy > Post processing > Pretty URLs
  2. Build the site locally, by running jekyll build.
  3. Run for url in $(find _site -name "*.html" -not -name "index.html"); do echo "$(echo $url | sed s,_site,, | sed s/.html//) $(echo $url | sed s,_site,,)"; done >> _redirects
  4. Run for url in $(find _site -name index.html -not -path _site/index.html); do echo "$(echo $url | sed s,_site,, | sed s,/index.html,,) $(echo $url | sed s,_site,,)"; done >> _redirects
  5. Commit and push _redirects.
@salomvary
salomvary / rest-idl.md
Created December 11, 2014 12:07
REST IDL
@salomvary
salomvary / datetime.java
Last active January 21, 2022 23:23
Java 8 Date and Time Parsing and Formatting Microtutorial
import java.time.format.DateTimeFormatter;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
Instant.now();
// java.time.Instant = 2015-08-13T09:28:27.141Z
DateTimeFormatter.ISO_INSTANT.format(Instant.now());
@salomvary
salomvary / untitled.html
Created August 14, 2015 06:50
untitled.html
<!doctype html>
<html>
<head>
<title>Untitled</title>
</head>
<body>
</body>
</html>
@salomvary
salomvary / dotroll-kft-incidens.md
Last active February 15, 2021 10:01
Incidens bejelentés - DotRoll Kft. 2021.02.15

Tisztelt Ügyfelünk!

Ezúton értesítjük, hogy a jelek szerint behatolás történt szervereink belső hálózatába. A behatolás során a támadónak lehetősége volt hozzáférni a szervereinken tárolt adatokhoz. Egyértelmű nyomokat nem találtunk arra vonatkozóan, hogy adatot tulajdonítottak volna el, azonban ezt sajnos kizárni sem tudjuk.

Ezért többek között a következő intézkedéseket végeztük el:

  • Az összes admin felhasználónk jelszavát megváltoztattuk és belépéshez kötelezővé tettük a két lépcsős authentikációt.
  • Az összes szerverünk SSH belépési jelszavait és kulcsait megváltoztattuk.
  • Felülvizsgáltuk az összes szerverünk tűzfalának beállításait.
  • Bejelentettük a Nemzeti Adatvédelmi és Információszabadság Hatóság felé az incidenst (NAIH).
  • A com/net/org/eu domain nevek eddigi authentikációs kódjai helyett újakat generáltunk.
// Works fine but what does `break` break and `continue` continue?
for (x of y) {
switch (x) {
case '':
if (condition)
continue
else
break
}
// Do more stuff
@salomvary
salomvary / README.md
Last active November 19, 2020 11:05
Electron Entitlements for Mac App Store

These are the entitlements files I managed to build an Electron app for Mac App Store distribution.

Tested with Electron 8 on macOS Catalina and Mojave.

Used latest electron-builder for packaging (see package.json for configuration). Should work with other packaging tools but hardened runtime must be turned off.

@salomvary
salomvary / 20 Ways of Writing React Components.tsx
Last active October 17, 2020 14:45
20 Ways of Writing React Components
import React, { createElement, Component, FC, Fragment, FunctionComponent, ReactNode } from 'react';
import createReactClass from 'create-react-class';
const C = () => <></>;
const C: FC = () => <></>;
const C: () => ReactNode = () => <></>;
const C: FunctionComponent = () => <></>;
const C = (props) => <>{props.p}</>;
const C: (props: {p: string}) => ReactNode = (props) => <>{props.p}</>;
const C = (props: {p: string}) => <>{props.p}</>;