Skip to content

Instantly share code, notes, and snippets.

View JulienSansot's full-sized avatar

Julien Sansot JulienSansot

View GitHub Profile
@JulienSansot
JulienSansot / script to check linux distro
Created May 14, 2015 01:14
script to check linux distro
#!/bin/sh
# Detects which OS and if it is Linux then it will detect which Linux Distribution.
OS=`uname -s`
REV=`uname -r`
MACH=`uname -m`
GetVersionFromFile()
{
VERSION=`cat $1 | tr "\n" ' ' | sed s/.*VERSION.*=\ // `
@JulienSansot
JulienSansot / Determine third point of triangle when two points and all sides are known.js
Created April 6, 2016 10:51
Determine third point of triangle when two points and all sides are known
//a,b,c are the sides of the triangle
function get_third_point_coordinates(a, b, c){
var result = {x:0,y:0};
if(a > 0){
result.x = (c*c - b*b + a*a) / (2*a);
}
result.y = Math.sqrt(c*c - result.x*result.x);
@JulienSansot
JulienSansot / mongodb dump and restore
Last active April 18, 2022 03:07
mongodb dump and restore
#with docker
docker run -it -v "$PWD"/mongo_dump:/data/dump --rm mongo:3.0.5 sh -c 'exec mongodump --out /data/dump --host=1.2.3.4 --db the_database'
docker run -it -v "$PWD"/mongo_dump:/data/dump --rm mongo:3.0.5 sh -c 'exec mongorestore --host=1.2.3.4 --db the_database /data/dump/the_database --drop'
#dump
sudo mongodump
#restore (droping previous data)
sudo mongorestore
@JulienSansot
JulienSansot / test_checkout.rb
Last active August 11, 2020 15:08
Checkout.com tests
# You need a .env file in the same folder:
# PUBLIC_KEY=....
# SECRET_KEY=....
#
# And then run with ruby test_checkout.rb
#
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'

Keybase proof

I hereby claim:

  • I am kalagan on github.
  • I am juliensansot (https://keybase.io/juliensansot) on keybase.
  • I have a public key ASCmcLwirMrKxlfHxSygRA4QMbvfEnj6_qf0e4L4Dhm62Ao

To claim this, I am signing this object:

@JulienSansot
JulienSansot / sublime text settings
Last active November 26, 2018 16:50
sublime text settings
{
"auto_match_enabled": false,
"detect_indentation": false,
"ignored_packages":
[
"Vintage"
],
"show_full_path": true,
"tab_size": 2,
"trim_trailing_white_space_on_save": true,
This file has been truncated, but you can view the full file.
A
A'asia
A's
AA
AA's
AAA
AAM
AB
AB's
ABA
@JulienSansot
JulienSansot / app.json
Created June 16, 2017 16:22
heroku postdeploy script to copy PG database
{
"scripts": {
"postdeploy": "pg_dump -Fc $DATABASE_URL_TO_COPY | pg_restore --clean --no-owner -n public -d $DATABASE_URL && bundle exec rails db:migrate"
}
}
@JulienSansot
JulienSansot / center image in div
Last active November 7, 2017 09:35
center image in div
- 1
the image uses the full width or full height of the div
we always see all the image, nothing is cropped
<div class="container"></div>
.container {
width: 500px;
height: 300px;
border: 1px solid black;
background-image: url("http://placehold.it/200x400");
background-repeat: no-repeat;
@JulienSansot
JulienSansot / android emulator with http proxy.sh
Created June 2, 2016 09:23
android emulator with http proxy
/Users/{user}/Library/Android/sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5_API_22 -http-proxy 192.168.60.1:8888