Skip to main content

Posts

Showing posts from November, 2015

[symfony] If want to use CSRF protection manually

// in formtype public function setDefaultOptions(OptionsResolverInterface $resolver) {     $resolver->setDefaults(array(         'data_class' => Entity::class,         'csrf_protection' => true,         'intention'  => 'entity_item_intention',     )); } // in twig <input type="hidden" name="token" value="{{ csrf_token(form_instance.vars.name) }}"> // in controller $token = $request->get('token') $this->get('security.csrf.token_manager')->isTokenValid(new CsrfToken($formTypeInstance->getName(), $token));

[ubuntu] rsync

rsync -auhzvHX --compress-level=9 --numeric-ids -e "ssh -T -c aes128-gcm@openssh.com -o Compression=no -x" -a all -u if a file is more recent than the source, skip it -h show human readable file size -z  compress -v verbose -W copy files whole (without delta-xfer algorithm) -H preserve hard links -S handle sparse files efficiently -X preserve extended attributes e.g. rsync -auhzvHX --compress-level=9 --numeric-ids -e "ssh -T -c aes128-gcm@openssh.com -o Compression=no -x" folder/* remote:/path/to/folder/