Skip to content

Instantly share code, notes, and snippets.

View jubianchi's full-sized avatar
🏳️‍🌈
nyan nyan nyan

Julien BIANCHI jubianchi

🏳️‍🌈
nyan nyan nyan
View GitHub Profile
@codedmonkey
codedmonkey / FooRequest.php
Last active June 27, 2018 21:20
[Symfony Form] Unique Entity Validation for Custom Data Objects (Use at own risk! Non-persisted changes to an entity will be reset after the validation process. A real solution would be to rewrite Symfony's UniqueEntityValidator completely.)
<?php
// src/Form/Request/FooRequest.php
namespace App\Form\Request;
use App\Validator\Constraints as AssertApp;
/**
* @AssertApp\UniqueEntity("bar", entityClass="App\Entity\Foo")
*/
@ernstki
ernstki / README.md
Last active April 8, 2024 12:12
List the ABI versions of all detected libc and libstdc++'s (GNU/Linux only)

Linker error messages related to libc and libstdc++

We run into the dreaded

/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found

error messages a lot around here. This article is an attempt to explain what's going on with that.

@SanCoder-Q
SanCoder-Q / synology.startup
Created December 25, 2017 14:29
Synology NAS - How to make a program run at startup
Synology NAS - How to make a program run at startup
The other day I created a little node.js project to keep track of some finances. Synology has a node.js package but that just installs the tools - it has no 'container' or any other support to drop files and have it run automagically. Maybe one day.
In the meantime, you can start your project when you SSH into the NAS. My project has a 'www' script which bootstraps my project, so to start I simply type 'node bin/www' from the project directory. But, it only runs while I'm logged in, and if I log out for any reason, the process dies. That's hardly useful when I'm away from home, or on a different PC. So I decided to have a look at starting my project as a Linux service.
After doing a lot of research into how Synology does services, and a few failed attempts at init scripts, I found that Synology DSM (since version 5 perhaps) bundles Upstart, which is a neat little tool to deal with services on Linux. It's most prevalent on Debian and derivatives (notably Ub
@mackwage
mackwage / windows_hardening.cmd
Last active April 23, 2024 15:13
Script to perform some hardening of Windows OS
:: Windows 10 Hardening Script
:: This is based mostly on my own personal research and testing. My objective is to secure/harden Windows 10 as much as possible while not impacting usability at all. (Think being able to run on this computer's of family members so secure them but not increase the chances of them having to call you to troubleshoot something related to it later on). References for virtually all settings can be found at the bottom. Just before the references section, you will always find several security settings commented out as they could lead to compatibility issues in common consumer setups but they're worth considering.
:: Obligatory 'views are my own'. :)
:: Thank you @jaredhaight for the Win Firewall config recommendations!
:: Thank you @ricardojba for the DLL Safe Order Search reg key!
:: Thank you @jessicaknotts for the help on testing Exploit Guard configs and checking privacy settings!
:: Best script I've found for Debloating Windows 10: https://github.com/Sycnex/Windows10Debloater
:
@stonehippo
stonehippo / docker_x11_gui_osx.md
Last active December 6, 2021 00:21
Getting X11 GUI applications to work on OS X with Docker

Getting X11 GUI applications to work on OS X with Docker

$ brew install socat
$ brew cask install xquartz <--- assuming you don't already have XQuartz installed some other way
$ open -a XQuartz <--- start an XQuartz session

$ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
@fasterthanlime
fasterthanlime / glibc-check.sh
Last active June 9, 2023 09:16
Prints the various glibc versions required by an executable
#!/bin/bash
# This scripts lets you check which minimum GLIBC version an executable requires.
# Simply run './glibc-check.sh path/to/your/binary'
#
# You can set `MAX_VER` however low you want, although I (fasterthanlime)
# feel like `2.13` is a good target (For reference, Ubuntu 12.04 has GLIBC 2.15)
MAX_VER=2.13
SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
@olalonde
olalonde / docker-machine-use-nfs.sh
Created August 13, 2015 14:48
Use NFS instead of vboxsf in Docker Machine
#!/bin/bash
#
# This script will mount /Users in the boot2docker VM using NFS (instead of the
# default vboxsf). It's probably not a good idea to run it while there are
# Docker containers running in boot2docker.
#
# Usage: sudo ./boot2docker-use-nfs.sh
#
@willprice
willprice / .travis.yml
Last active August 15, 2023 17:12
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@addyosmani
addyosmani / browserify.md
Last active March 28, 2016 02:06
Yeoman + Browserify

Yeoman generators with Browserify

Browserify is a tool that allows us to write node-style modules that compile for use in the browser. Like node, we write our modules in separate files, exporting external methods and properties using the module.exports and exports variables

generator-browserify is a generator with a Browserify setup, offering choices between Gulp or Grunt and Foundation or Bootstrap.

screenshot 2014-04-20 at 10 19 09 pm

generator-angular-with-browserify is a generator for bundling Angular.js with Browserify

Imaginons un systéme de billeterie obéissant aux rêgles suivantes :

  1. Un client peut acheter de 1 à n ticket;
  2. Un ticket est valable pour une et une seule personne;
  3. Le prix du ticket doit être 2 si la personne à moins de 4 ans, 10 si la personne à moins de 12 ans et 30 pour toute personne agée de plus de 12 ans.

Il nous est demandé de développer le code correspondant à cet ensemble de régles en obéissant aux paradigme de la programmation orientée objet.
Une implémentation possible pourrait être la suivante :