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
chmod cheat sheet | |
PERMISSION COMMAND | |
U G W | |
_____________________________________ | |
|rwx rwx rwx chmod 777 <filename> | | |
|_____________________________________| | |
|rwx rwx r-x chmod 775 <filename> | | |
|_____________________________________| |
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 | |
if [ -e /usr/bin/python ] | |
then | |
echo "Python found!" | |
else | |
echo "Python missing!" | |
fi |
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
DELETE FROM `table` | |
WHERE id IN (SELECT * | |
FROM (SELECT id FROM `table` | |
GROUP BY column HAVING (COUNT(*) > 1) | |
) AS A | |
); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<SetupPrereq> | |
<conditions> | |
<condition Type="16" Comparison="2" Path="[WindowsFolder]Microsoft.NET\Framework\v4.0.30319" FileName="mscorlib.dll" ReturnValue="4.0.30319.233"></condition> | |
<condition Type="1" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\wow6432node\Microsoft\Updates\Microsoft .NET Framework 4 Extended\KB2468871\" FileName="" ReturnValue=""></condition> | |
<condition Type="1" Comparison="2" Path="HKEY_LOCAL_MACHINE\SOFTWARE\wow6432node\Microsoft\Updates\Microsoft .NET Framework 4 Client Profile\KB2468871\" FileName="" ReturnValue=""></condition> | |
</conditions> | |
<operatingsystemconditions> | |
<operatingsystemcondition MajorVersion="5" MinorVersion="2" PlatformId="2" CSDVersion="" Bits="4" ProductType="1" ServicePackMajorMin="3"></operatingsystemcondition> | |
<operatingsystemcondition MajorVersion="5" MinorVersion="2" PlatformId="2" CSDVersion="" Bits="4" ProductType="2|3" ServicePackMajorMin="2"></operatingsystemcondition> |
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
int led = 13; | |
int in = 0; | |
void setup() { | |
pinMode(led, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
if (Serial.available() == 0) { |
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
find ./ -type f -exec sed -i 's/apple/orange/g' {} \; |
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
<?php | |
if (version_compare(phpversion(), '5.3.10', '<')) { | |
// php version isn't high enough | |
echo 'version too low.'; | |
} | |
else { | |
echo 'good to go.'; | |
} |
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
if (function_exists('function_name')) { | |
function_name() | |
} |
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
def human_size(size, si = false) | |
return '0' if size == 0 | |
base = si ? 1000 : 1024 | |
bytes = %w(B KB MB GB TB PB EB ZB YB) | |
cnt = Math.log(size, base).floor | |
size = size / (base * 1.0) ** cnt | |
fmt = size < 10 ? '%.1f %s' : '%i %s' | |
sprintf(fmt, size, bytes[cnt]) |
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
<?php | |
echo 'Current PHP version: ' . phpversion(); |
NewerOlder