Skip to content

Instantly share code, notes, and snippets.

View srghma's full-sized avatar

Serhii Khoma srghma.github.io/how-life-was-created srghma

View GitHub Profile
@srghma
srghma / MindTrash.md
Last active October 10, 2022 09:54
MindTrash

How to debug sublime plugins:

  • install rpdb through pip
  • import rpdb; rpdb.set_trace()
  • telnet 127.0.0.1 4444

Разница между CSRF (Cross-Site Request Forgery) и XSS (Cross-Site Scripting)

Оба - атака на пользователя, в отличие от SQL Injection (атака на сервер)

XSS:
  • цель - заставить браузер жертв(ы) исполнить код
@srghma
srghma / notes
Created December 29, 2017 16:45
aws
# connect
ssh centos@pubip_or_dns
ssh -i ~/.ssh/amazon/us-east-1 centos@pubip_or_dns
# add local key
paste ~/.ssh/id_rsa.pub to ~/.ssh/authorized_keys
# filezilla
https://forums.aws.amazon.com/thread.jspa?messageID=741338 but interactive
@srghma
srghma / fn.js
Created January 18, 2018 11:21
doAsyncOnSubmit
function doAsyncOnSubmit(form, asyncFn) {
const onSubmitFunction = async function(e) {
e.preventDefault()
form.off('submit', onSubmitFunction)
const doSubmit = await asyncFn()
if (doSubmit) {
form.submit()
@srghma
srghma / 1.what I have learned, while doing XXX1.md
Last active August 2, 2018 14:08
what I have learned, while doing XXX

Project specification:

ecommerce + news

Technologies:

@srghma
srghma / Postgraphile questions
Last active February 27, 2018 11:50
Postgraphile questions
Solved questions:
- how to send email after calling function? - postgres listen, notify
Unsolved questions:
- postgresql multidispatch functions?
- how to upload image and save it in db? (maybe schema stitching)
- rails like polymorphic relations?
- how to make vdare like role permissions?
@srghma
srghma / todo.md
Last active October 3, 2018 08:46
todo

haskell

https://stackoverflow.com/questions/42174785/multiple-io-effects-in-eff-or-other-ways-for-composable-effects

make 2 example apps using mtl and effects that asks password:

export DB_NAME=
export DB_USER=
mysqldump -p -u "$DB_USER" "$DB_NAME" | gzip > "$HOME/$DB_NAME-backup-$(date +%F).sql.gz"
bcrypt examples in ruby and php
@srghma
srghma / 0-ELFINDER TOKEN AUTHENTICATION, rails, tinymce, elfinder, nginx.md
Last active February 18, 2022 22:06
ELFINDER TOKEN AUTHENTICATION, rails, tinymce, elfinder, nginx

This is an example of using elfinder with bcrypt tokens.

It works like this:

  • backend and elfinder knows about secret token
  • user can access elfinder on localhost:8000/elFinder/elfinder.html, but cant write without token
  • backend adds hashed token to url only on some pages (admin panel for example)
  • tinymce opens elfinder.html in iframe with hashed token, elfinder.html iframe pass this token to connector, connector validates token
  • I use nginx to bypass cors issue

Sorry can provide more elaborate exmaple (proprietary software)