Skip to content

Instantly share code, notes, and snippets.

View frett27's full-sized avatar

Patrice Freydiere frett27

View GitHub Profile
@frett27
frett27 / vimtips
Created February 15, 2015 16:40
VIM commands
__BEGIN__
*vimtips.txt* For Vim version 7.3.
------------------------------------------------------------------------------
" new items marked [N] , corrected items marked [C]
" *best-searching*
/joe/e : cursor set to End of match
3/joe/e+1 : find 3rd joe cursor set to End of match plus 1 [C]
/joe/s-2 : cursor set to Start of match minus 2
/joe/+3 : find joe move cursor 3 lines down
/^joe.*fred.*bill/ : find joe AND fred AND Bill (Joe at start of line)
@frett27
frett27 / Git Tips
Last active May 31, 2019 16:18
Git aliases
Soft reset of branch pointer
git reset --hard f414f31
git reset --soft HEAD@{1}
git commit -m "Reverting to the state of the project at f414f31"
creating a random matrix
>>> np.random.rand(5,5)
array([[ 0.62571083, 0.65582837, 0.68177139, 0.01175444, 0.48659345],
[ 0.21193695, 0.52344695, 0.19238696, 0.11999955, 0.26967286],
[ 0.8413876 , 0.32192564, 0.68335969, 0.60749775, 0.93875251],
[ 0.38622055, 0.02982458, 0.84065832, 0.71816465, 0.34432988],
[ 0.99334523, 0.84521018, 0.20164392, 0.92211239, 0.5730022 ]])
@frett27
frett27 / firestations.geojson
Last active April 30, 2017 10:31
Zones containing a complete b
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@frett27
frett27 / ArcGIS Map Declaration
Last active April 2, 2016 16:37
Apache Zepplin ArcGIS Javascript mapping
%angular
<link rel="stylesheet" href="https://js.arcgis.com/3.16/esri/css/esri.css" />
<div id="map" style="height: 800px; width: 100%"></div>
<script type="text/javascript">
var map;
function initMap() {
@frett27
frett27 / gist:99613d52a42aede1468959781feb67ae
Created May 14, 2016 11:17
Activate SAR on linux ubuntu
Step 1. Install sysstat
sudo apt-get install sysstat
Step 2. Enable stat collection
sudo vi /etc/default/sysstat
change ENABLED=”false” to ENABLED=”true”
save the file
Step 3. Change the collection interval from every 10 minutes to every 2 minutes.
sudo vi /etc/cron.d/sysstat
configure the default.cgpr for avr : gprconfig -o default.cgpr --db . --target=avr
# ubuntu 16
sudo apt-get install -y software-properties-common
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && add-apt-repository -y ppa:webupd8team/java && apt-get update && apt-get install -y oracle-java8-installer && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/oracle-jdk8-installer
# ubuntu 14
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer

install armbian from website

install docker on the device

sudo curl -sSL get.docker.com | sh

-->for missing aufs support on default kernel, use overlay2

grant user for docker use

RP : aweek
stddev within 10 min
select stddev(value) from home.aweek.wifi where time > now() - 10m group by mac,time(1m) fill(none)
continuous query :
cq_temperature_avg_1d CREATE CONTINUOUS QUERY cq_temperature_avg_1d ON home BEGIN SELECT mean(value) INTO home.autogen.avg_temperature_avg_1d FROM home.autogen.temperature GROUP BY time(1d) END