This file contains hidden or 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
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
requestPermissions(); | |
scheduleWork(); | |
} | |
private void scheduleWork() { | |
// Set constraints for the work (optional) |
This file contains hidden or 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
curl https://get.docker.com | bash -s |
This file contains hidden or 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
FILE=/tmp/worker.nodes | |
touch ${FILE} || exit | |
for node in `docker node ls --filter role=worker -q`; do | |
if grep -Fxq "${node}" ${FILE} | |
then | |
echo "This node ${node} already exists" | |
else | |
echo "This node ${node} joined recently, so rebalance" | |
for service in `docker service ls -q`; do |
This file contains hidden or 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
for dir in $(aws s3 ls | awk '{print $3'}); do | |
size=$(aws s3 ls s3://${dir} --recursive | grep -v -E "(Bucket: |Prefix: |LastWriteTime|^$|--)" | awk 'BEGIN {total=0}{total+=$3}END{print total/1024/1024" MB"}'); | |
echo "${dir} => $size" | tee -a disk.txt | |
done |
This file contains hidden or 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
<?php | |
$db->between('created', '2014-05-05', '2014-05-10'); | |
// Produces: created BETWEEN '2014-05-05' AND '2014-05-10' | |
$db->from('tblinvoices')->where('clientid', '12')->between('created', '2014-05-05' , '2014-05-10')->fetch(); | |
// Produces: SELECT * FROM tblinvoices WHERE clientid = '12' AND created BETWEEN '2014-05-05' AND '2014-05-10' |
This file contains hidden or 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
<?php | |
$db->find_in_set('503', 'orders')->from('tblinvoices')->fetch(); | |
// Produces: SELECT * FROM tblinvoices WHERE FIND_IN_SET ('305', orders) | |
$db->where('id', 5)->find_in_set('503', 'orders')->from('tblinvoices')->fetch(); | |
// Produces: SELECT * FROM tblinvoices WHERE id='5' AND FIND_IN_SET ('305', orders) | |
$db->where('id', 5)->find_in_set('503', 'orders', 'OR')->from('tblinvoices')->fetch(); | |
// Produces: SELECT * FROM tblinvoices WHERE id='5' OR FIND_IN_SET ('305', orders) |
This file contains hidden or 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
<?php | |
// Get the entire row before we update and save it in $row | |
$row = $db -> where('id', $id) -> from('tblorders') -> fetch_first(); | |
// This will execute SELECT * FROM tblorders WHERE id = '12' ; I am using PHP | |
// MYSQLi wrapper from https://bitbucket.org/getvivekv/php-mysqli-class/ | |
// Now perform the UPDATE query | |
$data['email'] = 'someemail'; | |
$data['firstname'] = 'Vivek'; |
This file contains hidden or 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
<?php | |
class Password_Hash | |
{ | |
public static function hash($password) | |
{ | |
return hash("sha512", $password); | |
} |
This file contains hidden or 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
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.8.2.min.js"> </script> | |
<script src="advertisement.js"></script> | |
<script> | |
$(function(){ | |
if($.ads == undefined) | |
alert("Ads are disabled"); | |
}); | |
</script> |
This file contains hidden or 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
/* | |
* jQuery AdBlock Detection | |
* Author: Vivek | |
* Web: http://www.vivekv.com | |
* | |
* Create a file named advertisement.js with this one line content "$.ads = true;" | |
* Then include the file in your html. | |
*/ |
NewerOlder