Skip to content

Instantly share code, notes, and snippets.

View raychorn's full-sized avatar

Ray C Horn raychorn

View GitHub Profile
@raychorn
raychorn / gist:6464657
Created September 6, 2013 14:33
An interesting programming problem...
http://stackoverflow.com/questions/18647444/python-nested-dictionary-from-pathname
2 hours of pure entertainment...

Rails 3.0.pre on App Engine

You can Rails 3 on App Engine, but it won’t be especially useful until bundler 10. You should try these instead:

Install the Development Environment

The gems for the development environment include a pre-release appengine-tools gem that provides a pre-release version of jruby-rack.

#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
make install
@raychorn
raychorn / xml_split.py
Created February 14, 2018 00:44 — forked from benallard/xml_split.py
Small python script to split huge XML files into parts. It takes one or two parameters. The first is always the huge XML file, and the second the size of the wished chunks in Kb (default to 1Mb) (0 spilt wherever possible) The generated files are called like the original one with an index between the filename and the extension like that: bigxml.…
#!/usr/bin/env python
import os
import xml.parsers.expat
from xml.sax.saxutils import escape
from optparse import OptionParser
from math import log10
# How much data we process at a time
@raychorn
raychorn / smartsvn-unity-launcher.txt
Created August 23, 2018 14:53 — forked from byk0t/smartsvn-unity-launcher.txt
How to create ubuntu unitiy dash launcher for smartsvn application
1.Create desktop config file
sudo nano /usr/share/applications/smartsvn.desktop
2. Put the text below
[Desktop Entry]
Name=SmartSVN
Name[en]=SmartSVN
Name[ru]=SmartSVN
@raychorn
raychorn / astar.py
Created October 3, 2020 13:29 — forked from jamiees2/astar.py
A* Algorithm implementation in python.
# Enter your code here. Read input from STDIN. Print output to STDOUT
class Node:
def __init__(self,value,point):
self.value = value
self.point = point
self.parent = None
self.H = 0
self.G = 0
def move_cost(self,other):
return 0 if self.value == '.' else 1
@raychorn
raychorn / main.go
Created October 14, 2020 02:40 — forked from sysulq/main.go
A simple example to call python function from golang.
package main
import (
"github.com/qiniu/py"
"log"
//"path/filepath"
"strconv"
)
func callPythonFunction(file string, function string) (int, string) {
@raychorn
raychorn / Python_Go_Bridge_v1
Created October 17, 2020 14:17
Make Python faster by using GO as efficiently as possible with minimal effort. (with a bit of RUST).
Problem Statement:
Use Go to augment the processing power of Python.
Solutions:
(1) Call GO from Python:
This can be done but it is a bit tedious as shown below:
@raychorn
raychorn / GO Dataframes
Last active October 17, 2020 23:02
Data Analysis using GO
https://mungingdata.com/go/dataframes-gota-qframe/
https://github.com/go-gota/gota <-- Minimal.
https://github.com/tobgu/qframe <-- Stable?
https://github.com/rocketlaunchr/dataframe-go <-- Looks interesting.
Probably easier to use Python pandas to load the data then dump data into GO via JSON/Web localhost to crunch the data
possibly faster than using Python alone. Then respond back to Python with data it can load into a Pandas dataframe, etc.
@raychorn
raychorn / wsl-install_another_distro.md
Created October 17, 2020 19:13 — forked from artman41/wsl-install_another_distro.md
Instructions on how to install a custom distro in WSL2 (Windows SubSystem for Linux 2)

WSL install another distro

  1. Here are some default vars for the process
ISO_DIR=~/fedora;
ROOTFS_MOUNT_DIR=/mnt/contents

DISTRO_LOCATION=