Skip to content

Instantly share code, notes, and snippets.

View myrtleTree33's full-sized avatar
🦄

jhtong myrtleTree33

🦄
View GitHub Profile
@myrtleTree33
myrtleTree33 / install-node-pi.sh
Last active March 8, 2024 22:37
Install Node JS in 30 seconds for Raspberry Pi / ARM
#!/bin/bash
## Check for versions compiled with ARM at http://nodejs.org/dist/
## Inspired by http://oskarhane.com/raspberry-pi-install-node-js-and-npm/
## Fill in the Node Version here:
##########################################################################
NODE_VERSION="v0.10.21"
@myrtleTree33
myrtleTree33 / client.coffee
Created December 26, 2013 10:47
Express server with socket.io, up and running Both Client and Server run on NodeJS.
#######################
# IMPORTANT. WORKS ON:
# Express >= v3.x
# Socket.io >= v1.0
######################
io = require('socket.io-client')
socket = io('http://localhost:3000')
@myrtleTree33
myrtleTree33 / reconnect.sh
Created October 23, 2014 15:05
Auto reconnect a Raspberry Pi by pinging google. Does ifdown and ifup is connection is down.
#!/bin/bash
HOST=google.com
while :
do
if ping -c 1 $HOST &> /dev/null
then
echo 1
else
echo 0
# Restart connection if unavailable
@myrtleTree33
myrtleTree33 / index.html
Created April 9, 2015 06:31
Display number of users online and server status via JQUERY and GET
<!DOCTYPE html>
<html>
<head>
<title>Test submit form</title>
<!--<script language="JavaScript" type="text/javascript" src="js/voucher.js"></script>-->
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<meta charset="utf-8" />
</head>
<body>
Users online: <span id="usersOnline">0</span>
/* MIXINs */
@mixin transition( $val : ease 0.5s ) {
-webkit-transition: $val;
-moz-transition:$val;
-o-transition:$val;
-ms-transition:$val;
transition:$val;
}
@mixin text-shadow( $top: 3px, $left: 3px, $blur: 3px , $colour: #333 ) {
@myrtleTree33
myrtleTree33 / .conkyrc
Created June 12, 2015 14:17
My Conky Config
# Conkyrc by Hund @ ebupof.deviantart.com
# Sry for the chaos below, but atleast it works! ;)
background no
#19.41640788use_xft yes
xftfont Terminus:size=8
xftalpha 0.2
update_interval 3.0
total_run_times 0
own_window yes
@myrtleTree33
myrtleTree33 / App.java
Created July 20, 2015 09:22
Example of using JLibSVM
package org.joeltong.testJLibSvm;
import edu.berkeley.compbio.jlibsvm.ImmutableSvmParameter;
import edu.berkeley.compbio.jlibsvm.ImmutableSvmParameterGrid;
import edu.berkeley.compbio.jlibsvm.binary.BinaryModel;
import edu.berkeley.compbio.jlibsvm.binary.C_SVC;
import edu.berkeley.compbio.jlibsvm.binary.MutableBinaryClassificationProblemImpl;
import edu.berkeley.compbio.jlibsvm.kernel.LinearKernel;
import edu.berkeley.compbio.jlibsvm.util.SparseVector;
@myrtleTree33
myrtleTree33 / algorithms-arrays-mergeSort.java
Last active December 30, 2019 14:15
Algorithms / Arrays / Merge Sort
package org.joeltong.test;
import java.util.Arrays;
public class MergeSort {
static void mergeSort(int[] arr) {
mergeSort(arr, 0, arr.length - 1);
}
@myrtleTree33
myrtleTree33 / algorithms-arrays-insertionSort.java
Created December 30, 2019 14:15
Algorithms / Arrays / Insertion Sort
package org.joeltong.test;
import java.util.Arrays;
public class App {
public static void main(String[] args) {
int[] arr = new int[]{5,3,89,4,4,45,22,44,5,3};
insertionSort(arr);
@myrtleTree33
myrtleTree33 / algorithms-arrays-insertionSort.java
Created December 30, 2019 14:15
Algorithms / Arrays / Insertion Sort
package org.joeltong.test;
import java.util.Arrays;
public class App {
public static void main(String[] args) {
int[] arr = new int[]{5,3,89,4,4,45,22,44,5,3};
insertionSort(arr);