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 / _etc_conf.d_Xvfb
Created July 15, 2012 03:05
Xvfb on Gentoo
XVFB=/usr/bin/Xvfb
XVFBARGS=":100 -screen 0 1600x1200x24 -auth /etc/conf.d/Xvfb.cfg -nolisten tcp"
PIDFILE=/var/run/Xvfb.pid
@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 / 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 / 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')
@theclanks
theclanks / seamake.sh
Last active June 6, 2017 06:50
seafile client build
#!/usr/bin/env bash
yum install vala vala-compat wget gcc libevent-devel openssl-devel gtk2-devel libuuid-devel sqlite-devel jansson-devel intltool cmake qt-devel fuse-devel
echo "Building and installing seafile client"
export version=4.2.8 # change this to your preferred version
alias wget='wget --content-disposition -nc'
wget https://github.com/haiwen/libsearpc/archive/v3.0.2.tar.gz
wget https://github.com/haiwen/ccnet/archive/v${version}.tar.gz
@theclanks
theclanks / desk_stream.conf
Created December 10, 2013 14:10
Desktop Stream
Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 100
MaxClients 100
MaxBandwidth 1500
CustomLog -
NoDaemon
<Feed feed1.ffm>
File /tmp/feed1.ffm
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 / criptografia.php
Created October 10, 2013 21:15
Criptografia para PHP 5.3
<?
function encrypt($string, $key) {
$encryptionMethod = "AES-256-CBC";
$ivkey = sha1($key);
$iv = substr($ivkey, 0, 16);
return base64_encode(openssl_encrypt($string, $encryptionMethod, $key, 0, $iv));
}
--[[
$Id$
Copyright © 2007-2012 the VideoLAN team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.