Skip to content

Instantly share code, notes, and snippets.

View Bernardstanislas's full-sized avatar
🛫
Taking off

Stanislas Bernard Bernardstanislas

🛫
Taking off
View GitHub Profile
# Windows related mounts
UUID=74E0BAE0E0BAA82E /media/windows ntfs uid=1000,gid=1000,dmask=023,fmask=006,exec 0 2
UUID=7C5CBE535CBE0842 /media/data ntfs uid=1000,gid=1000,dmask=023,fmask=006,exec 0 2
#!/bin/bash
SSID=$(iwgetid -r)
PROXY="http://172.20.0.9:3128"
if [ "Klee" = "$SSID" ]
then
su stan -c "dbus-launch gsettings set org.gnome.system.proxy mode 'manual'"
rm /home/stan/.atom/.apmrc
@Bernardstanislas
Bernardstanislas / awesomplete.js
Last active October 2, 2015 16:18
Autocomplete
var Autocomplete = {
/**
* Component will mount.
* Check if the Awesomplete library is in the Window object.
*/
componentWillMount: function componentWillMount() {
// Check if Awesomplete is set in Window
if (!window.Awesomplete) {
throw new Error('Please include Awesomplete to your application. See http://leaverou.github.io/awesomplete/ for more information');
}
@Bernardstanislas
Bernardstanislas / awesomplete.js
Last active October 1, 2015 11:57
Autocomplete
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var pickList = nextProps.pickList;
var code = nextProps.code;
var newValue = nextProps.value;
var value = this._getValueFromCode(code, pickList);
if ('' === value && newValue) {
value = newValue;
}
this.setState({ value: value });
this._awesomeplete._list = this._extractListFromData(pickList);
@Bernardstanislas
Bernardstanislas / .bash_profile
Last active November 26, 2015 13:34
Bash profile
# Home
HOME='/c/Users/sbernard/'
cd $HOME
# Variables
GATEWAY="$(ipconfig | grep -a Passerelle | grep -P -o -a '([0-9]+\.){3}[0-9]+' | head -n 1)"
PROXY="http://172.20.0.9:3128"
KLEE_GATEWAY_ETHERNET="172.20.108.1"
KLEE_GATEWAY_WIFI="172.20.231.1"
@Bernardstanislas
Bernardstanislas / promise.js
Created September 15, 2015 11:58
Chain promise
firstService(firstArgs).then((firstData) => {
return secondService(secondArgs).then((secondData) => {
return {
firstKey: firstData,
secondKey: secondData
}
});
});
@Bernardstanislas
Bernardstanislas / cartridge_trad.jsx
Created September 11, 2015 08:43
Translation closure
module.exports = React.createClass({
mixins: [cartridgeBehaviour, mixinTrad],
displayName: 'tdbEntreprise',
cartridgeConfiguration(){
const translation = this.i18n('entreprise.monEntrepriseMin');
return {
cartridge: {component: React.createClass({
render() {return (<div><h2>{translation}</h2></div>); }
})},
actions: {
@Bernardstanislas
Bernardstanislas / update-all.sh
Created June 18, 2015 09:37
Update focus and focus components
#!/usr/bin/env bash
cd ../../focus
git checkout master
git pull
gulp build
cd ../focus-components
git checkout master
git pull
gulp build
cd ../rodolphe-demo/ui
@Bernardstanislas
Bernardstanislas / omdb.js
Last active August 29, 2015 14:22
OMDB scrapper
var http = require('http');
var fs = require('fs');
var runningSockets = 1000;
var maxId = 10000000;
var filename = 'dump';
if (http.globalAgent.maxSockets < runningSockets) {
http.globalAgent.maxSockets = runningSockets;
}
On Error Resume Next
Sheets("Output").Delete
Sheets.Add After:=Sheets(Sheets.Count)
Set outputSheet = Sheets(Sheets.Count)
outputSheet.Name = "Output" 'name it "output"