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
# Update all email address in a users table to a specific domain name | |
UPDATE users | |
SET email = CONCAT(LEFT(email, INSTR(email, '@')), 'example.com') |
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
$current = get_my_local_time('h:i a'); | |
$sunrise = "8:00 am"; | |
$sunset = "5:00 pm"; | |
$date1 = DateTime::createFromFormat('h:i a', $current); | |
$date2 = DateTime::createFromFormat('h:i a', $sunrise); | |
$date3 = DateTime::createFromFormat('h:i a', $sunset); | |
if ($date1 > $date2 && $date1 < $date3) { | |
echo 'enabled'; | |
} else { | |
echo "disabled"; |
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
$NumberOfLogicalProcessors = Get-WmiObject win32_processor | Select-Object -ExpandProperty NumberOfLogicalProcessors | |
ForEach ($core in 1..$NumberOfLogicalProcessors){ | |
start-job -ScriptBlock{ | |
$result = 1; | |
foreach ($loopnumber in 1..2147483647){ | |
$result=1; | |
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
################################ | |
gource commands | |
################################ | |
# basic command for big and long projects | |
gource --max-user-speed 500 --seconds-per-day 0.05 --file-idle-time 10 -e 0.005 -f --max-files 300 --hide-files | |
# some easy to understand commands | |
# for output file | |
--output-ppm-stream ~/ppm/ppm-kohana |
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
using Newtonsoft.Json; | |
using PasaBuy.App.Controllers.Notice; | |
using PasaBuy.App.Models.Onboarding; | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Net.Http; | |
namespace XamarinNet | |
{ |
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
function dbhook_activate() { | |
global $wpdb; | |
// #region CREATING TABLE FOR Clusters | |
$usn_cluster_tab = USN_CLUSTER_TAB; | |
if($wpdb->get_var( "SHOW TABLES LIKE '$usn_cluster_tab'" ) != $usn_cluster_tab) { | |
$sql = "CREATE TABLE `".$usn_cluster_tab."` ("; | |
$sql .= "`ID` bigint(20) NOT NULL AUTO_INCREMENT, "; | |
$sql .= "`cluster_name` varchar(120) NOT NULL, "; | |
$sql .= "`cluster_info` varchar(255) NOT NULL, "; |
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
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using Newtonsoft.Json; | |
namespace BytesCrafter.Xamarin | |
{ |
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
// According to the http://nodejs.org/docs/latest/api/os.html#os_os_cpus, times is | |
// an object containing the number of CPU ticks spent in: user, nice, sys, idle, and irq | |
// So you should just be able to sum the times and calculate the percentage, like below: | |
var cpus = os.cpus(); | |
for(var i = 0, len = cpus.length; i < len; i++) { | |
console.log("CPU %s:", i); | |
var cpu = cpus[i], total = 0; |