Skip to content

Instantly share code, notes, and snippets.

View Ceciile's full-sized avatar

Cecile FU Ceciile

View GitHub Profile
@eerohele
eerohele / swaparrayelements.js
Last active November 2, 2021 16:01
Swap two array elements (JavaScript)
/**
* Swap the elements in an array at indexes x and y.
*
* @param (a) The array.
* @param (x) The index of the first element to swap.
* @param (y) The index of the second element to swap.
* @return {Array} The input array with the elements swapped.
*/
var swapArrayElements = function (a, x, y) {
if (a.length === 1) return a;
@czxttkl
czxttkl / shell.c
Last active November 17, 2020 10:23
/*
============================================================================
Name : sh.c
Author : Zhengxing Chen
Version :
Copyright : czxttkl. Achieve Shell basic functions: execution, IO redirection and Pipe.
============================================================================
*/
#include <stdlib.h>
#include <unistd.h>
@czxttkl
czxttkl / l1vsl2.py
Last active October 14, 2016 15:45
import sklearn as sklearn
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn import linear_model
# Create synthetic data
num_samples = 500
num_unrelated_features = 1000
def f(x1, x2):