Skip to content

Instantly share code, notes, and snippets.

View steve-todorov's full-sized avatar

Steve Todorov steve-todorov

  • Carlspring Ltd.
  • Bulgaria
  • 12:51 (UTC +02:00)
View GitHub Profile
@steve-todorov
steve-todorov / 1-Explanations.md
Created September 16, 2016 01:29 — forked from danvbe/1-Explanations.md
A way to integrate FosUserBundle and HWIOAuthBundle

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@steve-todorov
steve-todorov / index.html
Created September 4, 2016 19:00 — forked from mandulaj/index.html
Webssh
<!doctype html>
<html>
<head>
<title>SSH Client</title>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.5/socket.io.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<style>
body {
margin: 0;
padding: 0;
@steve-todorov
steve-todorov / fuck-openldap.sh
Created April 13, 2016 01:39 — forked from jaseg/README.md
Convert openldap .schema files to .ldif files
#!/usr/bin/env bash
# convert OpenLDAP schema file to LDIF file
#
# Copyright 2012 NDE Netzdesign und -entwicklung AG, Hamburg
# Written by Jens-U. Mozdzen <[email protected]>
# Copyright 2014 jaseg <[email protected]>
#
# Permission is granted to use, modify and redistribute this file as long as
# - this copyright notice is left unmodified and included in the final code
@steve-todorov
steve-todorov / backup.sh
Created April 11, 2016 01:26
Create a backup of a file and try NOT to overwrite any previous backups. Also make sure not to create unnecessary backups in case the files are identical.
backup() {
f=$1
bkp=$f.bkp
index=1
while true; do
# Make sure NOT TO OVERWRITE a bkp file!!!
if [[ -f "$bkp.$index" ]]; then
prevBkp="$bkp.$index"
index=$((index+1))
@steve-todorov
steve-todorov / youtube-this.sh
Created March 22, 2016 01:45
Download youtube videos and convert them to mp3
#!/bin/sh
save_path=`pwd`
checkDeps() {
youtubedl=`which youtube-dl 2> /dev/null`
ffmpeg=`which ffmpeg 2> /dev/null`
if [[ $youtubedl == "" || $ffmpeg == "" ]]; then
echo ""
@steve-todorov
steve-todorov / nginx.conf
Created March 19, 2016 23:21 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@steve-todorov
steve-todorov / angularjs_directive_attribute_explanation.md
Last active February 24, 2016 02:29 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@steve-todorov
steve-todorov / formController.js
Created January 16, 2016 02:12 — forked from romaricdrigon/formController.js
Using AngularJS on Symfony2 forms
// An example controller binded to the form
function FormCntl($scope, $compile) {
// Consider using FosJsRouting bundle, if you want to use a Symfony2 route
$scope.formUrl = "http://url-to-fetch-my-form";
// Data from the form will be binded here
$scope.data = {};
// Method called when submitting the form
$scope.submit = function() {
@steve-todorov
steve-todorov / symfony-cache-clear.php
Created November 18, 2015 22:48
A way to easily clear symfony cache without wiping out absolutely everything from the cache/ENV directory.
<?php
class MyController extends Controller {
public function myAction() {
$finder = new Finder();
/**
* @var SplFileInfo $file
*/
foreach($finder->name('*ProjectContainer*')->depth(0)->in($this->getParameter('kernel.cache_dir')) as $file){
@steve-todorov
steve-todorov / Fix SUSE suspend
Last active October 25, 2017 14:58
Fix SUSE suspend
1. Check if /etc/default/grub has
GRUB_CMDLINE_LINUX_DEFAULT=" resume=/dev/sda2 splash=silent quiet showopts"
and "resume" points to the correct SWAP partition.
2. Check if using any nvidia drivers. If so - uninstall them and make sure to remove any files that blacklist "nouveau":
cd /etc/modprobe.d/
grep -i -R "nouveau" .