Skip to content

Instantly share code, notes, and snippets.

View nad2000's full-sized avatar
🇳🇿
Working from New Zealand

Radomirs Cirskis nad2000

🇳🇿
Working from New Zealand
View GitHub Profile
@nad2000
nad2000 / Zenburn.ini
Created March 16, 2016 14:38
Modified DarkHighlight2.ini to look like "Zenburn" for PyScripter
[PyScripter]
Version=2.6.0.0
[Highlighters\Python]
Name=SynPythonSyn
Tag=0
DefaultFilter=Python Files (*.py;*.pyw)|*.py;*.pyw
Enabled=TRUE
[Highlighters\Python\Options]
@nad2000
nad2000 / softmax.py
Last active November 2, 2018 20:07
Compute softmax values for each sets of scores in x. #ml, #deep_learning
"""Softmax."""
scores = [3.0, 1.0, 0.2]
import numpy as np
def softmax(x):
"""Compute softmax values for each sets of scores in x."""
E = np.exp(x)
return E / E.sum(axis=0)
@nad2000
nad2000 / intall_scipy.sh
Last active December 15, 2015 05:30
Install all dependencies for scipy on Ubuntu 14.x+
sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran
sudo apt-get install python-numpy python-scipy python-matplotlib python-pandas python-sympy python-nose
sudo apt-get install python3-numpy python3-scipy python3-matplotlib python3-pandas python3-sympy python3-nose
sudo pip3 install -U statsmodels
@nad2000
nad2000 / README.md
Last active November 7, 2015 08:36
Simple REST server that fetches data from DB:
# since Ubuntu still cannot find proper MTU with MTU=automatic. it gets set too low and causes connection problems.
# Hear is how to find MTU used on the current net by your AP:
# 1. Set up high (unrealistic) value, eg, 2000:
sudo ifconfig wlan0 mtu 2000
# 2. Ping a few times a well know host (suppressing fragmentation - Don't Fragment (DF)) with
# different packet sizes starting with.
# Either "any device along the path whose MTU is smaller than the packet will drop it, and send back an
# Internet Control Message Protocol (ICMP) Fragmentation Needed (Type 3, Code 4) message containing its MTU". Then you
@nad2000
nad2000 / fix_ath9k.sh
Created November 1, 2015 10:27
notes on troubleshooting wifi on Ubuntu 14.04
#sudo echo "options ath9k nohwcrypt=1 blink=1 btcoex_enable=1 enable_diversity=1" > /etc/modprobe.d/ath9k.conf
#sudo echo "options ath9k nohwcrypt=1 blink=1 btcoex_enable=1 enable_diversity=1" > /etc/modprobe.d/ath9k.conf
sudo sh -c 'echo "options ath9k blink=1 bt_ant_diversity=0 btcoex_enable=0 nohwcrypt=1 ps_enable =0 use_chanctx=0" > /etc/modprobe.d/ath9k.conf'
rmmod ath9k
modprobe -r ath9k
modprobe -b ath9k
@nad2000
nad2000 / extract_frames.sh
Created October 17, 2015 09:25
Extraction of frames from a video using ffmpeg.exe
ffmpeg -i video_file.ts destination_directory/img_%05d.jpeg
# Getting framerate:
ffprobe data/Movies/Cosmos/Cosmos.A.Space.Time.Odyssey.S01E06.HDTV.x264-LOL.mp4
# Keyframes:
ffmpeg -skip_frame nokey -i data/Movies/Cosmos/Cosmos.A.Space.Time.Odyssey.S01E06.HDTV.x264-LOL.mp4 -filter:v select='eq(pict_type\,I)' -vsync 0 frames/%09d.png
# Keyframes with scaling:
ffmpeg -skip_frame nokey -i data/Movies/Cosmos/Cosmos.A.Space.Time.Odyssey.S01E06.HDTV.x264-LOL.mp4 -filter:v select='eq(pict_type\,I)',scale='128:72' -an -vsync 0 frames/%09d.png
package main
import (
"flag"
"fmt"
"os"
"gopkg.in/pg.v3"
)
@nad2000
nad2000 / httpd.conf
Created September 1, 2015 06:35
how to configure Apache 2.x with mod_wsgi
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /myapp /opt/tms/lib/web/PA/myapp.wsgi
<Directory /opt/tms/lib/web/PA>
Order allow,deny
Allow from all
</Directory>
@nad2000
nad2000 / mirror_test.sh
Created August 17, 2015 00:37
This script tests a list of Apache mirrors for speed
#!/bin/bash
# mirror_test.sh
# This script tests a list of Apache mirrors for speed
#
# The scrip is based on Lance Rushing's <lance_rushing AT hotmail DOT com> script
# http://ubuntuforums.org/showthread.php?t=251398 for Ubutnu mirrors
#
# This script is covered under the GNU Public License: http://www.gnu.org/licenses/gpl.txt
# @AUTHOR Rad Cirskis <nad2000 AT gmail DOT com>
# @SINCE 8/1/2015