Skip to content

Instantly share code, notes, and snippets.

@isahiz
isahiz / k.py
Last active November 22, 2020 19:25
python program to calculate k-means for single dimension data points
from math import *
import sys
# python program to calculate K-means given single-dimension data points
# synopsis: `python3 k.py "<x values>" "<c values>" N`
# c values should be the values at t = 1
# N is the number of iterations
def get_arr_from_str(s):
arr_str = s.split(" ")
@isahiz
isahiz / PlayerFollow.cs
Created June 21, 2019 22:08
script for camera/background to follow player on Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerFollow : MonoBehaviour
{
public GameObject player;
private Vector3 offset = new Vector3(5.0f, 0, 0);
void Start()
@isahiz
isahiz / PlayerMovement.cs
Created June 21, 2019 21:52
basic player movement script for a Unity character controller script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public CharacterController controller;
public float runSpeed = 100f;
float horiz = 0f;
@isahiz
isahiz / copydir.py
Last active June 21, 2019 22:32
recursive copying of a file directory
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import os
import re
import time
import StringIO
from shutil import copyfile