Skip to content

Instantly share code, notes, and snippets.

@nanusdad
nanusdad / mongo_insert_from_json_file.md
Last active January 30, 2019 19:00
Inserting data from JSON files into mongo

Inserting data into mongo collection from JSON file

var file = cat('./20-new.json');  # file name
use testdb                        # db name
var o = JSON.parse(file);         # convert string to JSON
db.forms.insert(o)                # collection name

Inserting data using 'meteor mongo' into collection from JSON file

@nanusdad
nanusdad / excel_to_csv_to_mysql.md
Last active November 28, 2015 07:16
Excel to CSV to MySQL
  1. Save Excel worksheet as .csv file
  • might need to change new line characters
  • if saving on Mac - open in vi and run %s/^M/\r/g ( ctrl+M )
  1. Use the following example to load in CSV file from mysql prompt -
    load data infile '/tmp/tc_t.csv' 
    into table new_test_categories 
 fields terminated by ',' 
@nanusdad
nanusdad / APK_signing
Last active April 28, 2016 16:37
APK file signing and zipping for Play Store upload
cd ~/build-output-directory/android/
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 unaligned.apk your-app-name
$ANDROID_HOME/build-tools/23.0.0/zipalign 4 unaligned.apk production.apk
# To unsign APK
zip -d yourapp.apk "META-INF*"
# Creating keystore and then signing app for Play Store
@nanusdad
nanusdad / mysql_to_mongo_with_meteor.md
Last active November 28, 2015 07:19
MySQL to mongo in Meteor

Export to CSV from MySQL

SELECT * FROM books INTO OUTFILE '/tmp/books.csv'  
FIELDS TERMINATED BY ','  
ENCLOSED BY '"'  
LINES TERMINATED BY '\n'

Note fields in books table

DESC books;

@nanusdad
nanusdad / using_future_with_meteor.js
Last active November 30, 2015 07:12
Using Future with Meteor
function callToEngine(argument) {
var Future = Npm.require('fibers/future');
var fut = new Future();
///do stuff
engine.on('close', function(code)
{
@nanusdad
nanusdad / git_new_local_branch.md
Last active June 16, 2024 06:56
Git - create new local branch push to GitHub
@nanusdad
nanusdad / git_fetch_into_meteor.md
Last active November 30, 2015 07:17
Git fetch into Meteor

Using Git to manage Meteor app code

meteor create app
cd app
git init
git remote add origin PATH/TO/REPO
git fetch
git checkout -t origin/master
@nanusdad
nanusdad / svn-repo-move-to-another-server.md
Last active November 30, 2015 03:21
SVN - repository move to another server
  • Install svnserve server in newbox
  • Check working directory is fully checked-in at oldbox to subversion, and back it up.
  • Dump the subversion repository. This is done with an svnadmin command: at oldbox svnadmin dump /export/svnrepo/reponame | gzip -9 - > reponame.dump.gz
  • Create the new subversion repository ---- at newbox To create a repository ‘newrepo’ run the svnadmin create command from $SVNHOME/bin. Provide fullpath to the repository at newbox. svnadmin create /export/svnrepo/newrepo .
  • Copy the reponame.dump.gz file up to the newbox server.
  • Load the dumpfile into the new repository: at newbox zcat reponame.dump.gz | svnadmin load /export/svnrepo/newrepo
@nanusdad
nanusdad / moodle_on_digital_ocean.md
Last active November 5, 2021 21:15
Installing Moodle on Digital Ocean Ubuntu server
sudo apt-get update  
sudo apt-get install apache2
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

sudo vi /etc/apache2/mods-enabled/dir.conf 
	#add index.php to start of line
@nanusdad
nanusdad / node-express-https-svc.js
Last active November 30, 2015 07:26
Starting https service with Node / Express module
var fs = require('fs');
var express = require('express');
var securityOptions = {
key: fs.readFileSync('/certs/domain.com.key'),
cert: fs.readFileSync('/certs/domain.com.chained.crt'),
requestCert: true
};
// .......................................................