Månedsarkiv: juni 2003

PHP unicode decoder

function unicode_decode($txt) { $txt = preg_replace_callback( ‘/%u([[:alnum:]]{4})/’, create_function(‘$match’, ‘return “&#”.hexdec($match[1]).”;”;’), $txt ); $txt = preg_replace_callback( ‘/%([[:alnum:]]{2})/’, create_function(‘$match’, ‘return “&#”.hexdec($match[1]).”;”;’), $txt ); return ($txt); }  

Udgivet i Knowledge Base, Old Base, PHP, Programmering | Skriv en kommentar

Dead paths in FreeBSD

If your FreeBSD can’t find the path to a newly installed program from ports, just run “rehash”

Udgivet i FreeBSD, Knowledge Base, Old Base | Skriv en kommentar

Binary Prefix Definition

http://physics.nist.gov/cuu/Units/binary.html MegaBytes = 1000 * 1000 bytes MeBiBytes = 1024 * 1024 bytes

Udgivet i Knowledge Base, Old Base | Skriv en kommentar

cvsup FreeBSD to current

Install cvsup: cd /usr/ports/net/cvsup-without-gui && make install For Stable use tag=RELENG_4 Create file /usr/src/current-supfile with this inside: Use this cvsup file: # IMPORTANT: Change the next line to use one of the CVSup mirror sites *default host=cvsup.dk.FreeBSD.org *default base=/usr *default … Læs resten

Udgivet i FreeBSD, Knowledge Base, Old Base | Skriv en kommentar

Using threads in perl

Remember setting threads in your ./Configure, cause it’s not compiled by default! Example: #!/usr/bin/perl use Thread; new Thread \&test_sub; sub test_sub { while(1) { sleep 2; print “TestSUB\n”; } } while(1){ sleep 3; print “NormalProc\n”; } For more information, see … Læs resten

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

Netgear MR314 telnet interface

ifaces: enif0 = lan enif1 = wan ifconfig: ip ifconfig route: ip route status ip route add [/] [] ip route addiface [/] [] ip route drop [/] dhcp: ip dhcp status ip dhcp client release ip dhcp client renew … Læs resten

Udgivet i Hardware hacking, Knowledge Base, Old Base | Skriv en kommentar

Change NIC MAC in linux

root@spacecamp:~# ifconfig eth2 down root@spacecamp:~# ifconfig eth2 hw ether aa:aa:aa:aa:aa:aa root@spacecamp:~# ifconfig eth2 up root@spacecamp:~# ifconfig eth2 eth2 Link encap:Ethernet HWaddr AA:AA:AA:AA:AA:AA inet addr:192.168.20.1 Bcast:192.168.20.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:1275 … Læs resten

Udgivet i Knowledge Base, Linux, Networking, Old Base | Skriv en kommentar

Adding an ip alias to a NIC in FreeBSD & Linux

Freebsd : rc.conf: ifconfig_rl0_alias0=”10.1.1.24 netmask 0xffffffff” manually: ifconfig rl0 alias 10.1.1.24 netmask 0xffffffff Linux: ifconfig eth0:0 10.1.1.25 netmask 255.255.255.255

Udgivet i FreeBSD, Knowledge Base, Linux, Old Base | Skriv en kommentar

No color when programming ncurses on linux when connected via putty.

When you login via putty then your TERM is set to ‘xterm’. You will not be able to see colors with ncurses. Set TERM=’linux’ and you can now see the colors. cc

Udgivet i Knowledge Base | Skriv en kommentar

No color when programming ncurses on linux when connected via putty.

When you login via putty then your TERM is set to ‘xterm’. You will not be able to see colors with ncurses. Set TERM=’linux’ and you can now see the colors. cc

Udgivet i Linux | Skriv en kommentar