Skip to content

Instantly share code, notes, and snippets.

View immutef's full-sized avatar

immutef

  • SCAYLE GmbH
  • Hamburg, Germany
View GitHub Profile
@BlinkyStitt
BlinkyStitt / gource-multi
Created July 17, 2013 01:09
Run gource over a bunch of repos and save an mp4
#!/usr/bin/env bash
# Generates gource video (h.264) out of multiple repositories.
# Pass the repositories in command line arguments.
# Example:
# <this.sh> /path/to/repo1 /path/to/repo2
OUTFILE="gource.mp4"
set -x
@pborreli
pborreli / Instruction.md
Last active December 19, 2015 09:29
How to retrieve your GitHub Pull Request count using Google bigquery

Go to Google bigquery and execute the following query replacing XXX with your GitHub login

@miguelgrinberg
miguelgrinberg / rest-server.py
Last active March 29, 2024 09:05
The code from my article on building RESTful web services with Python and the Flask microframework. See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask_httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':
<?php
function pre_print_r($var){
echo "<pre>";
print_r($var);
echo "</pre>";
}
function Bigrams($word){
@77web
77web / 1_security.yml
Created February 25, 2013 07:23
How to switch user accounts between two(or more) different firewalls when using Symfony\Bundle\SecurityBundle
//you may have some more configs here...
providers:
user:
entity: { class: MyAppBundle:User, property: loginEmail }
admin:
entity: { class: MyAppBundle:Admin, property: username }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
@Mins
Mins / mysql_secure.sh
Last active May 31, 2024 14:19
Automating mysql_secure_installation
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@meltingice
meltingice / gist:4602034
Created January 23, 2013 04:44
iRacing SDK NodeJS bindings session output
{ WeekendInfo:
{ TrackName: 'okayama short',
TrackID: 167,
TrackLength: '1.93 km',
TrackDisplayName: 'Okayama International Circuit',
TrackDisplayShortName: 'Okayama Short',
TrackCity: 'Okayama',
TrackCountry: 'Japan',
TrackAltitude: '265.84 m',
TrackLatitude: '34.914295 m',
@danvbe
danvbe / 1-Explanations.md
Last active April 21, 2023 15:39
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.
@kaja47
kaja47 / gist:4407844
Created December 29, 2012 16:19
React.PHP promise timeout
<?php
use React\Promise\Deferred;
function timeout($time, $promise, $loop) {
$defer = new Deferred;
$r = $defer->resolver();
$sig = $loop->addTimer($time, function() use($r) {
$r->reject('timeout');
});
@beberlei
beberlei / pr.md
Created December 4, 2012 21:01 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: