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
#!/bin/bash | |
#written by akamaras.com | |
cname=$(cat /proc/cpuinfo|grep name|head -1|awk '{ $1=$2=$3=""; print }') | |
cores=$(cat /proc/cpuinfo|grep MHz|wc -l) | |
freq=$(cat /proc/cpuinfo|grep MHz|head -1|awk '{ print $4 }') | |
tram=$(free -m | awk 'NR==2'|awk '{ print $2 }') | |
swap=$(free -m | awk 'NR==4'| awk '{ print $2 }') | |
up=$(uptime|awk '{ $1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; print }') | |
cache=$((wget -O /dev/null http://cachefly.cachefly.net/100mb.test) 2>&1 | tail -2 | head -1 | awk '{print $3 $4 }') |
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
#!/bin/bash | |
for DISK in $(ls /dev/sd?); | |
do echo $DISK; | |
smartctl -a $DISK| grep -i "Failing now\|Device Model\|Short offline\|Extended Offline\|Reallocated_Sector_Ct\|Offline_Uncorrectable\|Raw_Read_Error_Rate\|Serial Number\|Power_On_Hours\|End-to-End_Error\|Self-test routine in progress...\|remaining"; | |
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
kill -9 $(cat /application/_run/rmq_task*`hostname`*) |
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
// include the AMQPlib Classes || use an autoloader | |
// queue/exchange names | |
$queueRightNow = 'right.now.queue'; | |
$exchangeRightNow = 'right.now.exchange'; | |
$queueDelayed5sec = 'delayed.five.seconds.queue'; | |
$exchangeDelayed5sec = 'delayed.five.seconds.exchange'; | |
$delay = 5; // delay in seconds | |
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
#!/usr/bin/env php | |
<?php | |
function en() {echo join(' ', func_get_args()),PHP_EOL;} | |
function eln() {echo join(PHP_EOL, func_get_args()),PHP_EOL;} | |
function runCase($num, $exe, $input, $output, $inData, $expected) { | |
global $haveErrors; | |
if ($input != 'stdin') { | |
$tmpInput = $input; | |
} else { |
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
// Input sequence of numbers | |
while (1) | |
{ | |
ch = getchar_unlocked(); | |
if (ch == EOF) | |
{ | |
// do something with N | |
break; | |
} | |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import os | |
import platform | |
import random | |
print "Content-Type: text/html" | |
rec_cnt = 0 | |
ed_cache = {} |
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
import java.math.BigInteger; | |
import java.util.*; | |
public class A | |
{ | |
public static void main(String args[]) | |
{ | |
Scanner in=new Scanner(System.in); | |
String a=in.next(); | |
String b=in.next(); |
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
function binadd($a, $b) { | |
$n = strlen($a); | |
$m = strlen($b); | |
$max = max($n, $m); | |
$sum = []; | |
$r = 0; | |
for ($i = 0; $i < $max; $i++) { | |
$s = ($n > $i ? $a{$i} : 0) + ($m > $i ? $b{$i} : 0) + $r; $r = 0; | |
$sum[] = $s & 1 ? '1' : '0'; | |
if ($s > 1) { |