man e2fsck
man badblocks
man badblocks
A record of solutions to when I get stuck on some problem. When I think 'I know I have found the answer to this before' I can just search my blog.
sort -t$'\t' +1 -2 export_1612.txt>sorted.txt
postgres, allow localhost with no password
/var/lib/pgsql/pg_hba.conf
on line: with host all all 127.0.0.1/32 md5
change md5 to trust
postgres, set new password
[user@server ~]psql -U postgres -h localhost -d postgres
ALTER USER postgres WITH PASSWORD 'newpass';
#where postgres is the dbname
pgsql -U postgres -d dbname
# (at pgsql prompt) this will give the schema of the table
dbname=# \d tablename
# (at pgsql prompt) view autoincrement expression for field
dbname=# \d tablename
# (at pgsql prompt) how to view next autoincrement number
dbname=# select nextval('tablename_fieldname_seq');
# (at pgsql prompt) how to set autoincrement number
dbname=# select setval('tablename_fieldname_seq', 50);
this is a system startup script kind of like the old autoexec.bat
/etc/rc.local
this is a bash startup script for that user, also an .sh
/home/username/.bash_profile
defaults for new users
/etc/skel/.bash_profile
CTRL-ALT-D
show desktop
FC8:
System > Preferences > Personal > Keyboard Shortcuts
CTRL-ALT <arrow> (l,r,u,d) to navigate between desktops
./app_to_launch &#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <shellapi.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])
{
if (argc!=2)
{
printf("Usage:\n");
printf(" BKLAUNCH.EXE [apptolaunch]\n");
printf(" BKLAUNCH.EXE notepad.exe\n");
exit(0);
}
ShellExecute(NULL, TEXT("open"), argv[1], NULL, NULL, SW_SHOW);
return 0;
}BKLAUNCH notepad.exe-bash: ./execute.sh: /usr/bash^M: bad interpreter: No such file or directory[user@linux1 ~] dos2unix execute.sh
dos2unix: converting files execute.sh to UNIX format...Assuming you have the files
./Makefile
./include/file1.h
./include/file2.h
./include/file3.h
./src/file1.cpp
./src/file2.cpp
./src/file3.cpp
and all obj files go in ./obj/
and your target executable is ./execfile
CC =g++
CFLAGS =-c -Wall
LDFLAGS =
INCLUDE =-I./include
OBJDIR =obj/
OBJLIST = file1.o file2.o file3.o
OBJECTS = $(addprefix $(OBJDIR), $(OBJLIST) )
all:execfile
execfile: $(OBJECTS)
[TAB]$(CC) $(LDFLAGS) $(OBJECTS) -o $@
$(OBJECTS): obj/%.o: src/%.cpp
[TAB]$(CC) $(CFLAGS) $? -o $@ $(INCLUDE)
clean:
[TAB]rm -rf obj/*.o<?php
//saves ip address and timestamp
file_put_contents("ip_list.txt", date("Y-m-d H:i:s") . ": ". $_SERVER['REMOTE_ADDR'] . "\n", FILE_APPEND);
header("content-type: image/gif");
//43byte 1x1 transparent pixel gif
echo base64_decode("R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
?>
Internet Explorer cannot open the internet site http://blah.blah.com/
Operation Aborted.fixed bitrates: :( 16 kbps :( 24 kbps :( 32 kbps :( 40 kbps :) 48 kbps :( 56 kbps :( 64 kbps :( 80 kbps :) 96 kbps :) 112 kbps :) 128 kbps :) 160 kbps :) 192 kbps :) 224 kbps :) 320 kbps variable bitrates (with lame; 0 is high quality, 9 is low): :) V0-6 :( V7-9
class Curlit
{
protected:
static char errorBuffer[CURL_ERROR_SIZE];
static string buffer;
static int writer(char *data, size_t size, size_t nmemb, string *buffer);
static string easycurl(string &url, bool post, string &pstring);
public:
Curlit();
~Curlit();
static string post(string &url, std::map<string, string> &querystr);
static string get(string &url);
static string escape(string ¶m);
};class Curlit
{
protected:
static char errorBuffer[CURL_ERROR_SIZE];
static string buffer;
static int writer(char *data, size_t size, size_t nmemb, string *buffer);
static string easycurl(string &url, bool post, string &pstring);
public:
Curlit();
~Curlit();
static string post(string &url, std::map<string, string> &querystr);
static string get(string &url);
static string escape(string ¶m);
};
char Curlit::errorBuffer[CURL_ERROR_SIZE];
string Curlit::buffer;
window.onbeforeunload = confirmExit;
function confirmExit()
{
return "Are you sure you want to leave this page?";
}
//this function is case insensitive
String.prototype.beginsWith = function(t) {
return (t.toLowerCase() == this.substring(0, t.length).toLowerCase());
}
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
return this.replace(/\s+$/,"");
}function isInt (str)
{
var i = parseInt (str);
if (isNaN (i))
return false;
if (i.toString() != str)
return false;
return true;
}function alert_obj(obj)
{
var str2='';
for(s in obj)
str2+= "obj["+s+"]"+obj[s]+"\n";
alert(str2);
}function xml_text_node(elem,nam)
{
try{
return elem.getElementsByTagName(nam)[0].firstChild.nodeValue;
}
catch(e){
return "";
}
}function count_children(myElement)
{
if (!myElement)
return 0;
var count=0;
var child = myElement.firstChild;
while (child!=null)
{
count++;
child = child.nextSibling;
}
return count;
}
function removeChildren(list)
{
if (list==null) return;
var child = list.firstChild;
while(child!=null)
{
list.removeChild(child);
child = list.firstChild;
}
}function DOMelement(txt)
{
var o = new Object();
o.elementname = txt;
o.attributes = new Object();
o.innerHTML = '';
o.innerText = '';
o.createElement = function()
{
var attribute_str = '';
for(attrib_name in o.attributes)
attribute_str+= attrib_name+"='"+escape(o.attributes[attrib_name])+"'";
var element;
try
{//IE
element = document.createElement("<"+o.elementname+" "+attribute_str);
}
catch (e)
{
element = document.createElement( o.elementname );
for(attrib_name in o.attributes)
element.setAttribute( attrib_name , o.attributes[attrib_name] );
}
if (o.innerHTML.length>0)
element.innerHTML = o.innerHTML;
else if (o.innerText.length>0)
element.appendChild( document.createTextNode(o.innerText) );
return element;
}
o.setAttribute = function(attribute,attribute_value)
{
o.attributes[attribute] = attribute_value;
}
return o;
}<?php
function die_force_page_to_https()
{
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='off')
{
$u='https://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
$t='';
$t.='<html>';
$t.= '<head>';
$t.= '<meta http-equiv="Refresh" content="0;url='.$u.'>';
$t.= '</meta>';
$t.= '</head>';
$t.= '<body>';
$t.= '</body>';
$t.='</html>';
die($t);
}
}
?> <?php echo phpinfo(); ?> LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.cLoadModule rewrite_module modules/mod_rewrite.soform {margin: 0px 0px 0px 0px; }
#include <windows.h>
int SetRegValue(char *key_name,char *key_word,char *b,int dwType,int s)
{
int j=0;
DWORD lpdwDisposition;
HKEY hKey;
j=RegCreateKeyEx(
HKEY_CURRENT_USER,
key_name,
0, /* reserved */
NULL, /* address of class string */
REG_OPTION_NON_VOLATILE, /* special options flag */
KEY_WRITE, /* desired security access */
NULL, /* address of key security structure */
&hKey, /* address of buffer for opened handle */
&lpdwDisposition /* address of disposition value buffer */
);
if (j==ERROR_SUCCESS)
{
RegSetValueEx(hKey, key_word, 0, dwType, (unsigned char *)b, s);
RegCloseKey(hKey);
}
return(j);
}
int main(int argc, char* argv[])
{
char val[100]="myusername";
SetRegValue("Software\\MySoft\\Settings","Username", val, REG_SZ, 100);
return 0;
}
bool isValidDate(int m, int d, int y)
{
//checks Gregorian date
if (! (1582<= y ) )
return false;
if (! (1<= m && m<=12) )
return false;
if (! (1<= d && d<=31) )
return false;
if ( (d==31) && (m==2 || m==4 || m==6 || m==9 || m==11) )
return false;
if ( (d==30) && (m==2) )
return false;
if ( (m==2) && (d==29) && (y%4!=0) )
return false;
if ( (m==2) && (d==29) && (y%400==0) )
return true;
if ( (m==2) && (d==29) && (y%100==0) )
return false;
if ( (m==2) && (d==29) && (y%4==0) )
return true;
return true;
}WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
SetWindowLong(Application->Handle,
GWL_EXSTYLE,
GetWindowLong(Application->Handle, GWL_EXSTYLE)
| WS_EX_TOOLWINDOW) ;
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
char psBuffer[128];
FILE *iopipe;
if( (iopipe = _popen( "dir", "rt" )) == NULL )
exit( 1 );
while( !feof( iopipe ) )
{
if( fgets( psBuffer, 128, iopipe ) != NULL )
printf( psBuffer );
}
printf( "\nProcess returned %d\n", _pclose( iopipe ) );
return 0;
}
//you do the initial checkout like this:
svn checkout [svn path] [destination path]
//svn path: svn://192.168.0.93/srv/svn/src/trunk/proj
//dest path: /srv/www/htdocs/dest_path
//user note: it may prompt for a username and password
//this will update to the most recent revision
svn update [destination path]
//for more details call
svn checkout help
// or
svn update help

#include <map>
#include <string>
using namespace std;
int main()
{
std::map<std::string, std::string> m;
m["ENG"] = "English";
m["FRA"] = "France";
m["CAN"] = "Canada";
m["AUS"] = "Australia";
//does print empty string
cout<<m["Germany"]<<endl;
//iterate through all elements of array
std::map<string, string>::iterator curr,end;
for( curr = m.begin(), end = m.end(); curr != end; curr++ )
cout << curr->first + " = " + curr->second << endl;
return 0;
}<script language='JavaScript' type='text/JavaScript'
src='script.js'/><script language='JavaScript' type='text/JavaScript'
src='script.js'></script>
#include <string>
#include <iostream>
using namespace std;
int main ( int argc, int argv[] )
{
cout << "running....\n";
cout<<"finished"<<endl;
return 0;
}
#compile
CFG=/usr/bin/mysql_config
sh -c "gcc -o mysqltest `$CFG --cflags` main.cpp `$CFG --libs`"test.cpp: In function âint main()â:
test.cpp:7: error: âcoutâ was not declared in this scope
test.cpp:7: error: âendlâ was not declared in this scopeexport LANG=C