Skip to content

Instantly share code, notes, and snippets.

@enxt
enxt / fix-gp-routes.ps1
Created December 15, 2022 07:46 — forked from 01000101/fix-gp-routes.ps1
PowerShell script to remove unwanted "full tunnel" Palo Alto GlobalProtect VPN routes.
# Description name of the GlobalProtect interface
$gp_iface = "PANGP Virtual Ethernet Adapter"
# Routes to remove from the GlobalProtect interface
$bad_routes = @(
'0.0.0.0/0',
'10.1.10.0/24',
'10.1.10.255/32',
'172.16.100.0/24',
'192.168.1.0/24')
# How many loops used to remove routes.
@enxt
enxt / ema.py
Created November 2, 2019 14:50
Simple EMA calculation with pandas
def EMA(data, window):
return pd.Series(data).ewm(span=window, adjust=False).mean()
@enxt
enxt / clusteringordersize.R
Created October 5, 2019 14:52
Cluster vector into equal size groups
a <- runif(100, 0.01, 1)
o <- split(order(a), ceiling(seq_along(a)/20))
a <- cbind(a, g=NA)
for(i in 1:length(o)) { a[o[[i]], c('g')] <- i }
# visual test
library(ggplot2)
ggplot(as.data.frame(a), aes(x=seq_along(a), y=a, color=g)) + geom_point()
@enxt
enxt / GitCommands.md
Last active November 19, 2018 16:16
Common git commands
  • Create branch with the current changes
    git checkout -b <new_branch> [from_branch]
  • Publish branch
    git checkout <branch-name>
    git push origin <branch-name>
  • Git merge dry-run
@enxt
enxt / qtrinside.pro
Last active September 14, 2017 13:29
#-------------------------------------------------
#
# Project created by QtCreator 2017-09-13T08:41:36
#
#-------------------------------------------------
QT += core gui testlib network svg xml
CONFIG += c++11
CONFIG += console
@enxt
enxt / geneticAlgorithms.R
Last active August 13, 2018 07:15 — forked from thertrader/geneticAlgorithms
Using Genetic Algorithms in Quantitative Trading
############################################################
## Using Genetic Algorithms in Quantitative Trading
##
## thertrader@gmail.com - Mar 2014
############################################################
library(PerformanceAnalytics)
library(rgenoud)
library(quantmod)
library(TTR)
getSymbol.gainc <- function(pair, year, month) {
# Required packages, loads both zoo and xts
require("xts")
op <- options()
options("digits.secs"=5)
options("download.file.method"="wget")
basepair = paste(tolower(pair), year, month, sep="_")
pair = toupper(pair)
pair = paste(substr(pair, 1, 3), "_", substr(pair,4, 6), sep="")
@enxt
enxt / tmp.R
Created May 23, 2017 12:43
R test future stream_in
library(future)
library(jsonlite)
basicHander <- function(jsdata) {
print(jsdata)
}
basicDisconnect <- function(a) {
cat("Deberia llamar a connect_p")
cat("....", a)
@enxt
enxt / git graph log
Last active August 29, 2015 14:22
Git graph log from command line
# add to .gitconfig on home folder
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
@enxt
enxt / TuneRPI.sh
Last active August 12, 2017 21:01
Bash script to slimming raspbian image and prepare with nginx and php
#!/bin/sh
sudo apt-get update
sudo apt-get -y upgrade
sudo dpkg-reconfigure tzdata
sudo apt-get -y install console-data locales
sudo dpkg-reconfigure console-data
sudo dpkg-reconfigure locales