11
-
PHP - Upgrade all pack...
by tino
[November 26, 2021, 08:54:45 pm] -
ESP8266 - AT Firmware
by tino
[November 02, 2019, 12:07:28 pm] -
PHP Recursive Lint Check
by tino
[October 20, 2018, 12:15:49 pm] -
Replace text in mulitp...
by tino
[October 20, 2018, 12:05:30 pm] -
Remove whitespace from...
by tino
[July 08, 2018, 06:59:48 pm] -
Amp Test Image
by tino
[April 06, 2018, 03:55:05 pm] -
MISC Queries
by tino
[May 05, 2017, 10:57:38 pm] -
PIC 24F Atomic Access
by tino
[May 04, 2017, 05:08:41 pm] -
Lazy Load Class
by tino
[February 26, 2017, 07:07:35 pm] -
Postfix call script vi...
by tino
[February 26, 2017, 06:55:29 pm]
12
Tutorials / Amp Test Image
Last post by tino -13
PostgreSQL / Re: MISC Queries
Last post by tino -Code: [Select]
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
kill running query
Code: [Select]
SELECT pg_cancel_backend(procpid);
Kill idle query
Code: [Select]
SELECT pg_terminate_backend(procpid);
14
PostgreSQL / MISC Queries
Last post by tino -Code: [Select]
SELECT T1.log_dt, T2.log_dt, EXTRACT(EPOCH FROM (T2.log_dt - T1.log_dt))
FROM power_data AS T1
INNER JOIN power_data AS T2
USING ( node )
WHERE T1.log_dt > '2017-05-05 22:10:00'
AND T2.log_dt > '2017-05-05 22:10:00'
ORDER BY T1.id, T2.id
LIMIT 2
15
C Code / PIC 24F Atomic Access
Last post by tino -Code: [Select]
#define ATOMIC for(INTCONbits.GIE=0;!INTCONbits.GIE;INTCONbits.GIE=1)
16
PHP Code / Lazy Load Class
Last post by tino -Code: [Select]
class MyClass {
public function __construct() {
echo 'I am initialized!';
}
}
$getMyClass = function() {
$myClass = new MyClass();
return $myClass;
};
Code: [Select]
$myClass = $getMyClass();
17
Tutorials / Postfix call script via bcc
Last post by tino -Code: [Select]
vim /etc/postfix/master.cf
Add the following
Code: [Select]
-o receive_override_options=no_address_mappings
Just below the
Code: [Select]
smtp inet n - - - - smtpd
Setup the recipient bcc
Code: [Select]
vim /etc/postfix/recipient_bcc
Add the following as appropriate
Code: [Select]
upload@tinoest.co.uk upload-script@localhost
Run postmap so postfix can read it.
Code: [Select]
postmap /etc/postfix/recipient_bcc
Setup the transport
Code: [Select]
vim /etc/postfix/transport
Add the following as appropriate
Code: [Select]
upload-script@localhost :
Run postmap so postfix can read it.
Code: [Select]
postmap /etc/postfix/transport
edit the main.cf
Code: [Select]
vim /etc/postfix/main.cf
Add the following:
Code: [Select]
recipient_bcc_maps = hash:/etc/postfix/recipient_bcc
transport_maps = hash:/etc/postfix/transport
Also ensure that localhost is in the mydestination list
Edit the /etc/aliases file
Code: [Select]
vim /etc/aliases
Add the following, to point to the relevant file you wish to parse the data
Code: [Select]
upload-script: "|/usr/bin/postfix-parse"
Then restart postfix
Code: [Select]
systemcntl restart postfix
18
Tutorials / LTSP Debian Jessie Install
Last post by tino -Code: [Select]
apt-get install ltsp-server dnsmasq
Build the client
Code: [Select]
ltsp-build-client --arch i386
Edit the exports file
Code: [Select]
vim /etc/exports
Add the following to the bottom
Code: [Select]
/opt/ltsp *(ro,no_root_squash,async,no_subtree_check)
Restart the Service
Code: [Select]
invoke-rc.d nfs-kernel-server reload
Just to be sure...
Code: [Select]
service nfs-kernel-server restart
Create the DNS masq files
Code: [Select]
ltsp-config dnsmasq
Amend one of the created files
Code: [Select]
vim /opt/ltsp/i386/etc/ltsp/update-kernels.conf
Change the following line:
Code: [Select]
CMDLINE_NFS="root=/dev/nfs ip=dhcp boot=nfs"
To
Code: [Select]
CMDLINE_NFS="root=/dev/nfs ip=dhcp boot=nfs nfsroot=/opt/ltsp/i386"
IPAPPEND=3
Update everything.
Code: [Select]
ltsp-chroot /usr/share/ltsp/update-kernels
ltsp-update-kernels
19
MySQL / MySQL ORDER BY
Last post by tino -Code: [Select]
ORDER BY status ASC; will return 1,2,3,4.
Code: [Select]
ORDER BY status DESC; will return 4,3,2,1.
Code: [Select]
ORDER BY FIELD(status, 3, 2, 4, 1);
20
PostgreSQL / Auto Increment
Last post by tino -Code: [Select]
CREATE SEQUENCE teams_id_seq;
ALTER TABLE teams ALTER id SET DEFAULT nextval('teams_id_seq');
ALTER SEQUENCE teams_id_seq OWNER TO elabftw;
ALTER SEQUENCE teams_id_seq OWNED BY teams.id;