Skip to content

Instantly share code, notes, and snippets.

Avatar

Sascha Watermeyer zuch

  • Cape Town, South Africa
View GitHub Profile
@zuch
zuch / parse.py
Created Aug 8, 2012
python - get filenames and folders of a directory using os walk
View parse.py
#!/usr/bin/python
import os
#globals
top = "/home/zuch/WWW/translate/archive" #root directory of archive
#node class
class node:
path = ""
@zuch
zuch / csvgen.java
Created Aug 15, 2012
java - csv file generator
View csvgen.java
//reads in file with strings seperated by whitespaces
//outputs a csv file with results
import java.io.*;
class csvgen
{
private static String file_name = "test.csv";
public static void main(String args[])
@zuch
zuch / hits.php
Created Aug 18, 2012
php - count hits to a page
View hits.php
<?php
$hit_count = @file_get_contents('count.txt'); // read the hit count from file
if ($hit_count > 1)
$init_date = @file_get_contents('init_date.txt');
else
@file_put_contents('init_date.txt', date('F j, Y, g:i a'));
echo $hit_count . " visits</br>";
echo "since " . $init_date;
$hit_count++; // increment the hit count by 1
@zuch
zuch / parse.js
Created Sep 14, 2012
jquery - Parse JSON with jQuery Example
View parse.js
/********************************** example **************************************/
var base_url = 'http://people.cs.uct.ac.za/~swatermeyer/VulaMobi/';
function example()
{
var response = "";
var form_data = {
username: username,
password: password
View git_commands.txt
#check changes on current branch
git status
#ignore changes to a file before committed
# ignore file
git checkout <file>
# ignore cached file on github
git rm --cached <file>
@zuch
zuch / input.json
Created Aug 13, 2013
jquery - Populate List with JSON using jQuery
View input.json
{
"Shoe": [
{
"Women": [
{
"Sandals": [
{
"Slide": [
{
"id": "1",
@zuch
zuch / JSONtoXML.java
Last active Jul 22, 2020
java - Convert JSON to XML
View JSONtoXML.java
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;
import org.json.JSONException;//http://bit.ly/12O4D2w
@zuch
zuch / alphaSort.java
Last active Dec 21, 2015
java - Sort String Alphabetically using Count, Bubble & Quick Sort
View alphaSort.java
/*
* Sort String Alphabetically using Count, Bubble & Quick Sort
*/
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
final public class alphaSort
@zuch
zuch / rails_ubuntu.sh
Created Sep 4, 2013
Shell script to set up Rails on Ubuntu
View rails_ubuntu.sh
#!/bin/bash
RUBY_VERSION="1.9.3"
LOG_FILE="$HOME/install.log"
echo "Rails Installer started"
# Installing Dependencies
echo ".......Updating package cache....."
sudo apt-get update >>$LOG_FILE
View Unix Bible
UNIX
~~~~
Command Description
~~~~~~~ ~~~~~~~~~~~
awk Search for a pattern within a file. Includes
a built-in programming language.
bdiff Compares two large files.
You can’t perform that action at this time.