Skip to content

Instantly share code, notes, and snippets.

View theclanks's full-sized avatar

Luis Carlos Otte Junior theclanks

View GitHub Profile
@theclanks
theclanks / gcloud-port-forward.md
Created June 2, 2022 03:51 — forked from jibs/gcloud-port-forward.md
port forwarding with a google cloud instance

Google cloud's ssh command lets you pass standard ssh flags. To, for example, forward local port 8088 to port 8088 on a vm instance, all you need to do is:

gcloud compute  ssh --ssh-flag="-L 8088:localhost:8088"  --zone "us-central1-b" "example_instance_name"

Now browsing to localhost:8088 works as it would with standard ssh.

@theclanks
theclanks / pandas_memory_reduction.py
Created August 5, 2020 14:48
Reducing pandas memory usage
## Function to reduce the DF size
def reduce_mem_usage(df, verbose=True):
numerics = ['int16', 'int32', 'int64', 'float16', 'float32', 'float64']
start_mem = df.memory_usage().sum() / 1024**2
for col in df.columns:
col_type = df[col].dtypes
if col_type in numerics:
c_min = df[col].min()
c_max = df[col].max()
if str(col_type)[:3] == 'int':
@theclanks
theclanks / nnet_plot_update.r
Created June 12, 2018 18:52 — forked from fawda123/nnet_plot_update.r
nnet_plot_update
plot.nnet<-function(mod.in,nid=T,all.out=T,all.in=T,bias=T,wts.only=F,rel.rsc=5,
circle.cex=5,node.labs=T,var.labs=T,x.lab=NULL,y.lab=NULL,
line.stag=NULL,struct=NULL,cex.val=1,alpha.val=1,
circle.col='lightblue',pos.col='black',neg.col='grey',
bord.col='lightblue', max.sp = F,...){
require(scales)
#sanity checks
if('mlp' %in% class(mod.in)) warning('Bias layer not applicable for rsnns object')
Random file 1G
<SAMSUNG HD322HJ 1AC01118> ATA-7 SATA 2.x device
150.000MB/s transfers (SATA, UDMA5, PIO 8192bytes)
outside: 102400 kbytes in 0.854841 sec = 119788 kbytes/sec
ZFS escrita - 26.233768 segs
ZFS leitura MD5 - 14 segs
UFS escrita - 50 segs
@theclanks
theclanks / FreeBSD_confs.txt
Created December 13, 2015 10:59
FreeBSD Configs
/boot/loader.conf:
zfs_load="YES"
cuse4bsd_load="YES"
kern.ipc.shmmax=67108864
kern.ipc.shmall=32768
kern.ipc.shmmni=1024
kern.ipc.shmseg=1024
@theclanks
theclanks / timeseries.txt
Created October 14, 2015 21:31
time series link
http://stackoverflow.com/questions/26290314/r-calculate-a-count-of-items-over-time-using-start-and-end-dates
https://books.google.com.br/books?id=hFbSBQAAQBAJ&pg=PA188&lpg=PA188&dq=r+time+series++duration&source=bl&ots=pP2acGIQqc&sig=jo6m67G2SMR3dLhYsJ9yjVe9hjs&hl=pt-BR&sa=X&redir_esc=y#v=onepage&q=r%20time%20series%20%20duration&f=false
http://stackoverflow.com/questions/31583944/decompose-xts-hourly-time-series/31586363#31586363
http://stackoverflow.com/questions/17156143/how-to-create-a-r-timeseries-for-hourly-data
https://rpubs.com/hrbrmstr/time-series-machinations
http://stats.stackexchange.com/questions/120806/frequency-value-for-seconds-minutes-intervals-data-in-r
http://www.statmethods.net/advstats/timeseries.html
@theclanks
theclanks / ssl_curl
Created January 21, 2015 11:48
SSL curl
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
.cshrc
setenv UNAME_v "FreeBSD 8.3-RELEASE #0: Sat Nov 29 11:15:09 BRST 2014 root@bsd:/usr/obj/usr/src/sys/GENERIC"
setenv UNAME_r 8.3-RELEASE
setenv PACKAGESITE "ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/"
pkg_add -r bmake
cp /usr/bin/make /usr/bin/make.old
rm /usr/bin/make
ln -sv /usr/local/bin/bmake /usr/bin/make
@theclanks
theclanks / sel_custom_firefox.txt
Created November 26, 2014 18:10
Selenium - Webdriver Custom Firefox
wget https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/25.0/linux-i686/en-US/
profile = webdriver.FirefoxProfile("/compat/linux/opt/firefox/firefox-bin")
self.driver = webdriver.Firefox(profile)
Criar Branch:
mkdir branches/2.14.0
svn add branches/2.14.0
svn cp trunk/projeto branches/2.14.0/projeto
cd branches/
svn commit -m "Branch criada"
svn up
Merge do trunk para a branches com uma revisao: