Skip to content

Instantly share code, notes, and snippets.

@vikas-gonti
vikas-gonti / Solutions
Last active September 14, 2019 17:53
Solution to 20 questions at http://nn02.itversity.com/cca175/
:'Problem 1
#Connect to the MySQL database on the itversity labs using sqoop and import all of the data from the orders table into HDFS
Output Requirements
#Place the customer files in the HDFS directory
#/user/yourusername/problem1/solution/
#Replace yourusername with your OS user name
#Use a text format with comma as the columnar delimiter
#Load every order record completely'
sqoop import \
@robert8138
robert8138 / toy_DAG_definition_file.py
Last active December 26, 2019 14:50
A toy example of a DAG definition file in Airflow
"""
A DAG docstring might be a good way to explain at a high level
what problem space the DAG is looking at.
Links to design documents, upstream dependencies etc
are highly recommended.
"""
from datetime import datetime, timedelta
from airflow.models import DAG # Import the DAG class
from airflow.operators.sensors import NamedHivePartitionSensor
from airflow.operators.hive_operator import HiveOperator
@PieterScheffers
PieterScheffers / mysql_get_last_updated_id.sql
Created June 21, 2016 10:56
MySQL - Get id of updated rows
# http://stackoverflow.com/questions/1388025/how-to-get-id-of-the-last-updated-row-in-mysql
# single row update
SET @update_id := 0;
UPDATE some_table SET column_name = 'value', id = (SELECT @update_id := id)
WHERE some_other_column = 'blah' LIMIT 1;
SELECT @update_id;
# Multiple rows updated
SET @uids := null;
@santoshachari
santoshachari / Laravel PHP7 LEMP AWS.md
Last active March 21, 2025 14:46
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@stefanthoss
stefanthoss / mysql-pandas-import.py
Last active December 26, 2023 19:48
Import data from a MySQL database table into a Pandas DataFrame using the pymysql package.
import pandas as pd
import pymysql
from sqlalchemy import create_engine
engine = create_engine("mysql+pymysql://USER:PASSWORD@HOST:PORT/DBNAME")
df = pd.read_sql_query("SELECT * FROM table", engine)
df.head()
@gabrieleangeletti
gabrieleangeletti / rbm_after_refactor.py
Last active July 27, 2021 14:32
Restricted Boltzmann Machine implementation in TensorFlow, before and after code refactoring. Blog post: http://blackecho.github.io/blog/programming/2016/02/21/refactoring-rbm-tensor-flow-implementation.html
import tensorflow as tf
import numpy as np
import os
import zconfig
import utils
class RBM(object):
@volkancirik
volkancirik / extract_from_vgg.py
Last active March 13, 2017 16:05
Extract Features from VGG
'''
Extract Features from a pre-trained caffe CNN Layer
based on https://github.com/karpathy/neuraltalk/blob/master/python_features/extract_features.py
'''
import sys
import os.path
import argparse
import numpy as np
from scipy.misc import imread, imresize
@kaikuehne
kaikuehne / openface.md
Last active February 22, 2020 17:50
Installation and using openface to create and use your own classifier

Installation

Installation instructions are basically notes that I took while installing openface on MacOSX El Capitan.

System packages

brew install bash coreutils curl findutils opencv
brew install python --framework --universal --with-brewed-openssl
brew install boost-python --universal
@pupadupa
pupadupa / Lravel-5-inpalce-edit-using-xeditable.php
Last active May 19, 2022 12:55
Laravel 5 inplace editing using jquery's x-editable plugin . Inline and bulk editing examples.
/**
*
* In this example we create view with inplace and bulk editing.
* Tools and plugins:
* jQuery
* xEditable jquery plugin
* twitter bootstrap
*
*/
@willvincent
willvincent / db_backup.sh
Last active October 19, 2017 12:59
Intended for use with cron. This script will backup all (or one specific) database, the specified user has access to on the given DB server, and remove backups older than the specified duration to keep them for. If no params are passed, defaults will be used. and backups created for _every_ database.
#!/bin/bash
USAGE="$0 [-u <user> -p <password> -h <host> -P <PORT> -d <database> -D <destination/directory/without/trailing/slash>]"
DESTINATION=`pwd`
USER=root
PASS=root
HOST=localhost
PORT=3306
# SPECIFY HOW LONG TO RETAIN BACKUPS