Skip to content

Instantly share code, notes, and snippets.

View aphe's full-sized avatar
👋
Oh, Hi there!

Afriyandi Setiawan aphe

👋
Oh, Hi there!
View GitHub Profile
@aphe
aphe / opencv-dependencies-and-install.sh
Last active August 29, 2015 14:14
Opencv dependencies and install
#dependencies:
sudo apt-get install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils
#install (download source and cd to source):
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
#make :
make -j2
@aphe
aphe / lask.py
Created January 7, 2015 09:54
RSSI to distance
__author__ = 'phe'
A = -72
n = 4
'''
RSSI = -(10*n*log10(d) + A)
A is the RSSI value at a reference distance
'''
distance = pow(10.0, ((A + 71)/(10.0*n)))
print distance;
@aphe
aphe / VBoxStuff.txt
Last active August 29, 2015 14:11
VirtualBox Stuff
##Virtualbox change VDI
VBoxManage internalcommands sethduuid [new vdi]
##Virtualbox change from size changeable to fixed
VBoxManage clonehd vdia.vdi vdib.vdi --variant Fixed
##Virtualbox change size
VBoxManage modifyhd CentOs.vdi --resize 10000000 (on Mega)
@aphe
aphe / vlc.sh
Created December 10, 2014 07:04
VLC Startup Script
vlc —no-video-title-show —fullscreen —repeat videonya
vlc --mouse-hide-timeout=1 --qt-minimal-view --video-on-top --no-video-title-show --fullscreen --repeat videonya
@aphe
aphe / ImageMagick with Brew.sh
Created December 10, 2014 06:57
ImageMagick with Brew and Ghostscript support
brew install imagemagick --with-ghostscript
@aphe
aphe / Dump Cpickle.py
Created December 10, 2014 06:46
Dump Cpickle
import cPickle
f = open(some_file, "w")
f.write(cPickle.dumps(binary))
f.close()
@aphe
aphe / Remove File extension.py
Created December 10, 2014 06:38
Python Remove file extension
filename = filenye[filenye.rfind("/") + 1:].replace(".pdf", "")
@aphe
aphe / Python walk search for *.pdf file on directory and sub.py
Last active August 29, 2015 14:11
Python walk search for *.pdf file on directory and sub
for root, dirnames, filenames in os.walk(some_directory):
for filename in fnmatch.filter(filenames, '*.pdf'):
@aphe
aphe / Multiple Positional Argument Python.py
Last active August 29, 2015 14:11
Multiple Positional Argument Python
import argparse
class DefaultListAction(argparse.Action):
CHOICES = ['file', 'folder']
def __call__(self, parser, namespace, values, option_string=None):
if values:
for value in values:
if value not in self.CHOICES:
message = ("invalid choice: {0!r} (choose from {1})"
.format(value,
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static