View replication_monitor.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USER=<your mysql username> | |
PASSWORD=<your mysql password> | |
SUBJECT="Mysql Replication Problem" | |
EMAIL=<your monitor email> | |
RESULT=`mysql -u$USER -p$PASSWORD -e 'show slave status\G' | grep Last_SQL_Error | sed -e 's/ *Last_SQL_Error: //'` | |
if [ -n "$RESULT" ]; then | |
echo "$RESULT" | mail -s "$SUBJECT" $EMAIL |
View Monitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
public class Monitor { | |
public static void main(String[] args) throws IOException { | |
if (args.length < 3) | |
throw new IllegalArgumentException("Invalid number of arguments"); |
View send_email.cgi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use CGI; | |
# Create a CGI.pm object | |
my $cgi = new CGI; | |
# Get the form data | |
my $email_address = $cgi->param('email'); | |
my $feedback = $cgi->param('message'); | |
my $name = $cgi->param('name'); |
View AsyncStorage_getItem.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AsyncStorage.getItem('preferences') | |
.then(value => { | |
if (value) { | |
console.log('PreferencesScreen - preferences:', value) | |
let terms = [] | |
let prefs = value.split(',') | |
for (let i = 0; i < prefs.length; i++) { | |
terms.push({key: i, term: prefs[i]}) | |
} | |
this.setState({terms: terms}) |
View componentDidMount.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentDidMount() { | |
this.props.navigation.setParams({ | |
onTabFocus: this.getFeeds | |
}); | |
this.getFeeds() | |
} |
View axios.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
axios.post(FEED_URL, | |
{ | |
terms: terms, | |
limit: LIMIT | |
}, | |
{ timeout: TIMEOUT } | |
) | |
.then(res => { | |
this.showFeeds(res) | |
console.log('FeedsScreen - loading feeds is done') |
View app.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"expo": { | |
"name": "Balsa", | |
"description": "A super lightweight news feed", | |
"githubUrl": "https://github.com/tonyvu2014/balsa", | |
"sdkVersion": "25.0.0", | |
"icon": "balsa.png", | |
"version": "0.1.6", | |
"slug": "balsa", | |
"ios": { |