Skip to content

Instantly share code, notes, and snippets.

View RodolpheGohard's full-sized avatar

Rodolphe RodolpheGohard

View GitHub Profile
@RodolpheGohard
RodolpheGohard / tnbi18n.js
Last active August 29, 2015 14:07
My a-bit-hacky implementation for automatic partial loading with angular-translate.
(function () {
//NB: parts have been stripped to improve readability
var l10nModule = angular.module( 'tnbl10n', [
'ngResource',
'sessionstatus' //This is a module we use here to get the language in use
] );
//Backend link
@RodolpheGohard
RodolpheGohard / shiny.css
Created February 19, 2015 10:32
shiny text color animation. CAUTION: Hazardous material. Wear suitable eye protection.
.shiny {
color: #FFF;
animation-name: homeCycle;
animation-duration:1s;
animation-direction:alternate;
animation-iteration-count:infinite;
-webkit-animation-name: homeCycle;
-webkit-animation-duration:1s;
-webkit-animation-direction:alternate;
angular.module('ngControllerLocals',[]).config(function ($provide) {
$provide.decorator('ngControllerDirective', function ($delegate, $parse, $controller) {
var directive = $delegate[0];
directive.controller = function controllerWrapperForLocals($scope, $attrs, $element, $transclude) {
var ngController = $attrs.ngController;
var locals = {
$scope: $scope,
$attrs: $attrs,
$element: $element,
$transclude: $transclude
@RodolpheGohard
RodolpheGohard / getAllMatches.js
Created July 4, 2016 10:32
get all matches of a regex on a string.
// see https://github.com/lodash/lodash/issues/2459
const getAllMatches = (source, regex) => {
const matches = [];
source.replace(regex, function() {
matches.push({
match: arguments[0],
offset: arguments[arguments.length-2],
groups: Array.prototype.slice.call(arguments, 1, -2)
});
@RodolpheGohard
RodolpheGohard / data.csv
Created June 16, 2020 07:19
Weather data python exercise
variable Temperature Precipitation Total Wind Speed Wind Direction
2020-06-02T00:00:00 17.308187 0 4.5833187 35.53766
2020-06-02T01:00:00 15.248188 0 7.0533133 10.885529
2020-06-02T02:00:00 13.628188 0 10.137212 3.0127716
2020-06-02T03:00:00 12.798187 0.1 12.831524 4.7636414
2020-06-02T04:00:00 12.738188 0.1 13.271961 10.407715
2020-06-02T05:00:00 10.708188 0 10.293525 10.437485
2020-06-02T06:00:00 8.858188 0 9.87119 273.09406
2020-06-02T07:00:00 9.588188 0 10.389601 270
2020-06-02T08:00:00 11.208188 0 10.474637 262.69424
@RodolpheGohard
RodolpheGohard / optiperf.sh
Created November 4, 2020 14:13
sets the laptop up for audio production
cpupower frequency-set -g performance
echo 3072 > /sys/class/rtc/rtc0/max_user_freq
/sbin/sysctl -w vm.swappiness=10
@RodolpheGohard
RodolpheGohard / samba-ubuntu.md
Last active May 31, 2021 08:25
samba config on ubuntu
@RodolpheGohard
RodolpheGohard / pgpass_from_spring_properties.py
Created May 31, 2021 08:24
Extracts a .pgpass file from spring datasource in .properties
import sys
from configparser import ConfigParser
from urllib.parse import urlparse
CONFIG_PATH = sys.argv[1] if len(sys.argv)>1 else "application.properties"
with open(CONFIG_PATH, 'r') as f:
config_string = '[dummy]\n' + f.read()
config = ConfigParser()

Contributing guidelines

commits and commit message

Commit messages are for traceability. Any dev should understand the whys of a given implementation by looking at commits. This means:

  • Write useful commit messages
  • Avoid modyfing code when not directly needed

The general rule is: Use common sense, ask yourself what a dev, in 18 months, should read when he inspects a line you wrote because he needs to know why things are coded like this.

@RodolpheGohard
RodolpheGohard / Dockerfile
Created March 29, 2022 15:01
My dev in docker config
FROM node:14.17.3-slim
# Dependencies
RUN apt update && apt -y install curl less unzip git vim procps && apt clean
# Installing AWS client, https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html#cliv2-linux-install
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.2.38.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
# AWS config
COPY .aws /root/.aws
# Setting NPM prefix in a volume for persistence