Skip to content

Instantly share code, notes, and snippets.


Mohamed I. sangimed

View GitHub Profile
max747 /
Created November 2, 2011 07:32
Executing functional tests of Spring MVC Controller with AnnotationConfig
public class AnnotationConfigWebApplicationContextLoader extends AnnotationConfigContextLoader {
protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) {
MockServletContext servletContext = new MockServletContext();
// copy of GenericWebApplicationContext#postProcessBeanFactory
beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(servletContext));
Nyholm / gist:4c2a960531d5d81c062b
Last active November 30, 2017 19:58
Display flash messages in Symfony2
View gist:4c2a960531d5d81c062b
{# Check if we got a session without creating one #}
{% if app.request.hasPreviousSession %}
{# Check if we got some flash messages #}
{% if app.session.flashbag.peekAll()|length > 0 %}
<div id="flash">
{# Loop all types of flash messages #}
{% for type, flashMessages in app.session.flashbag.all() %}
{# For all flash messages with this type #}
{% for idx, flashMessage in flashMessages %}
<div class="flash-item flash-type-{{ type }}">
roxma / shared_folder_centos_virtualbox.txt
Created October 25, 2016 07:42 — forked from larsar/shared_folder_centos_virtualbox.txt
Mount shared folder on CentOS in VirtualBox
View shared_folder_centos_virtualbox.txt
# The VirtualBox documentation[1] for how to install guest additions
# for Linux on a virtual host is somewhat messy. So here is what
# I did to make it work.
# Install the packages required
yum update
yum install gcc kernel-devel make
adamtester /
Last active April 12, 2019 16:58
Install wkhtmltopdf on Ubuntu 14.04+
sudo apt-get update
sudo apt-get install wkhtmltox
sudo apt-get -f install
sudo dpkg -i wkhtmltox-
wkhtmltopdf -V
rm wkhtmltox-
maxfierke /
Last active September 8, 2020 14:34
PM2 as a Windows Service under Local Service

PM2 as a Windows Service under Local Service

Written for jon-hall/pm2-windows-service#3

This is a PoC for running PM2 as a Windows Service under the Local Service account instead of the Local System account.


  • Neither pm2 or pm2-windows-service installed yet. (The Powershell script will run npm i)
    • At the very least, you should run pm2-service-uninstall before running this script
  • npm and npm-cache global folders should be somewhere accessible to NT AUTHORITY\LocalService.
jczaplew / gist:5799404
Last active July 19, 2021 09:34
502 Proxy Error with Apache, Node, and MySQL
View gist:5799404
Node running on :8080
Apache running on :80
Using Apache mod_proxy to forward application requests to :8080
On client:
1. Proxy Error
The proxy server received an invalid response from an upstream server.
0xjjpa /
Created December 9, 2012 04:37
Understanding Google Chrome Extensions


Developing Chrome Extensions is REALLY fun if you are a Front End engineer. If you, however, struggle with visualizing the architecture of an application, then developing a Chrome Extension is going to bite your butt multiple times due the amount of excessive components the extension works with. Here are some pointers in how to start, what problems I encounter and how to avoid them.

Note: I'm not covering chrome package apps, which although similar, work in a different way. I also won't cover the page options api neither the new brand event pages. What I explain covers most basic chrome applications and should be enough to get you started.

Table of Contents

  1. Understand the Chrome Architecture
  2. Understand the Tabs-Extension Relationship
  3. Picking the right interface for the job
RulerOf /
Last active July 8, 2022 22:21
Adjusting Plex Media Player streaming quality defaults and per-stream

Setting a default quality in Plex Media Player desktop

The Plex Media Player desktop application's default quality setting is in different places depending on the interface you're using. The Plex Web UI is used as a point-and-click interface, whereas the Plex Media Player TV UI is used as a remote-friendly interface.

Plex Web UI Plex Media Player TV UI
fuzunspm / client-axios.js
Last active September 12, 2022 21:43
Nestjs File download
View client-axios.js
export default class http {
async download(endpoint) {
const token = this.loadToken();
const invoice = await axios({
url: `${this.NEST_APP_IP}/${endpoint}`,
method: 'GET',
responseType: 'blob',
headers: {
Authorization: `Bearer ${token}`
}}).then((response) => {
mjclemente / app.e2e-spec.ts
Created August 4, 2020 21:30 — forked from firxworx/app.e2e-spec.ts
NestJS Integration/E2E Testing Example with TypeORM, Postgres, JWT
View app.e2e-spec.ts
import { Test, TestingModule } from '@nestjs/testing'
import { INestApplication, LoggerService } from '@nestjs/common'
import * as request from 'supertest'
import { AppModule } from './../src/app.module'
class TestLogger implements LoggerService {
log(message: string) {}
error(message: string, trace: string) {}
warn(message: string) {}
debug(message: string) {}