Skip to content

Instantly share code, notes, and snippets.

View tuttelikz's full-sized avatar
🔨
生き甲斐

San Askaruly tuttelikz

🔨
生き甲斐
View GitHub Profile
@tuttelikz
tuttelikz / edit_csv_bash
Last active April 30, 2018 08:19
Instructions on how to leave with only specific columns of csv file
Print only second and third column of a file and save with a different name:
###############################################################
awk -F, '{ print $2, $3 }' data_hr.csv > data_hr1.csv
###############################################################
Only print on terminal without 1st column of a file:
###############################################################
cut --complement -f 1 -d, data_hr.csv
###############################################################
@tuttelikz
tuttelikz / different_versions_d3
Created April 30, 2018 07:01
Simple gist showing how to insert d3 charts of different versions into same html page
// First declare third version as a separate variable
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
d3version3 = d3
window.d3 = null
</script>
// Then declare fourth version as a separate variable
@tuttelikz
tuttelikz / create_duplicate_project_git
Created April 29, 2018 04:01
This is a gist demonstrating how you can create a duplicate of a project
In your case, I would suggest going with [submodules](https://stackoverflow.com/a/19279658/403401). However to answer your exact question, here's how you should proceed.
1. Start by creating `Jeremy/MyShooter` and `Jeremy/MyRPG` on Github. Keep them empty.
2. Clone your origin project on your system, twice, giving it different names
$ git clone http://github.com/Bob/CoolFramework MyShooter
$ git clone http://github.com/Bob/CoolFramework MyRPG
@tuttelikz
tuttelikz / create_gh-pages-branch
Created April 29, 2018 03:59
This is a simple procedure how one can create gh-pages branch on newly created repository
# Github's web hosting looks for a branch called "gh-pages"
# Git by names the default branch "master" so we must rename
# it to "gh-pages" so that Github can find the website files.
# In terminal/cmd
#############################################################
mkdir YOUR_REPO.github.com
cd YOUR_REPO.github.com
echo "# hello Sanzhar" >> README.md
git init
@tuttelikz
tuttelikz / csv2tsv
Last active April 26, 2018 06:45
Instructions on how to convert TSV to CSV file
First, add to file and name it as csv2tab.sh the following script:
###########################################################################
#!/usr/bin/env python
import csv, sys
csv.writer(sys.stdout, dialect='excel-tab').writerows(csv.reader(sys.stdin))
###########################################################################
Then, locate your terminal to the directory where you saved .sh file and give it execution permissions with:
###########################################################################
chmod +x the_file_name
@tuttelikz
tuttelikz / choose_second_li_element
Last active April 24, 2018 06:25
a way to choose specific li element
<script>
d3.select("li:nth-child(2n)").style("color", "red"); # second
d3.select("li:nth-child(even)").style("color", "red"); # even
</script>
@tuttelikz
tuttelikz / show_collection_elements_mongo
Created April 23, 2018 06:00
Command to show data of mongodb collection
#Once you are in terminal/command line, access the database/collection you want to use as follows:
show dbs
use <db name>
show collections
# choose your collection and type the following to see all contents of that collection:
db.collectionName.find()
@tuttelikz
tuttelikz / mongo_db_import
Created April 23, 2018 05:57
This is a gist to import json file to a mongodb collection
mongoimport --db sleepmon1 --collection sensorValues --drop --file ~/Videos/data.json --jsonArray
@tuttelikz
tuttelikz / jsftp_test.js
Created April 19, 2018 09:20
Simple script to test library: https://github.com/sergi/jsftp
const userInfo = "sanzhar"
const passInfo = "unist"
const jsftp = require("jsftp");
const Ftp = new jsftp({
host: "mico.knu.ac.kr",
port: 22, // defaults to 21
user: userInfo, // defaults to "anonymous"
pass: passInfo // defaults to "@anonymous"
@tuttelikz
tuttelikz / csv_file_tricks_android
Created April 19, 2018 03:55
In this way you can create csv file comma delimiter
writer.append(index_only);
writer.append(",");
writer.append(time_only);
writer.append(",");
writer.append(hr_only);
writer.append(",");
writer.append(ox_only);
writer.append(",");
writer.append(temp_only);
writer.append("\n");