SSH
clients will automatically be disconnected from the server and prompt the below message after being idle or inactive for a while.
Read from remote host oseems.com: Connection reset by peer Connection to oseems.com closed.
This is due to the SSH
servers’ configuration (often by default) to avoid hanging sessions and free up resources.
If you have administrative access to the SSH
servers, you can configure it so that it will not easily disconnect idle sessions. This could be achieved by setting the parameters for TCPKeepAlive
, ClientAliveInterval
, and ClientAliveCountMax
as per the following;
TCPKeepAlive no ClientAliveInterval 30 ClientAliveCountMax 240
SSH
server configuration file is normally /etc/ssh/sshd_config
. Restart the SSHd
service for the changes to take effect.
What it basically means is that the server will not send the TCP
alive
packet to check if the client’s connection is working, yet will still send the encrypted alive
message every 30 seconds. It will only disconnect after at least 2 hours of inactivity.
The following is the full explanation for the options;
TCPKeepAlive Specifies whether the system should send TCP keepalive messages to the other side. If they are sent, death of the connection or crash of one of the machines will be properly noticed. However, this means that connections will die if the route is down temporarily, and some people find it annoying. On the other hand, if TCP keepalives are not sent, sessions may hang indefinitely on the server, leaving “ghost” users and consuming server resources. The default is “yes” (to send TCP keepalive messages), and the server will notice if the network goes down or the client host crashes. This avoids infinitely hanging sessions. To disable TCP keepalive messages, the value should be set to “no”. This option was formerly called KeepAlive. ClientAliveCountMax Sets the number of client alive messages (see below) which may be sent without sshd(8) receiving any messages back from the client. If this threshold is reached while client alive messages are being sent, sshd will disconnect the client, terminating the session. It is important to note that the use of client alive messages is very different from TCPKeepAlive (below). The client alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option enabled by TCPKeepAlive is spoofable. The client alive mechanism is valu‐ able when the client or server depend on knowing when a connection has become inactive. The default value is 3. If ClientAliveInterval (see below) is set to 15, and ClientAliveCountMax is left at the default, unresponsive SSH clients will be disconnected after approximately 45 seconds. This option applies to pro‐ tocol version 2 only. ClientAliveInterval Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. This option applies to protocol version 2 only.
If you don’t have administrative access to the server, you can configure your SSH
client to send the alive
message to the server instead to achieve the same result. The key here is the ServerAliveInterval
option for the SSH
client.
You can do this by updating /etc/ssh/ssh_config
(applying the setting to every user in the system) or in ~/.ssh/config
(single user). Set the following option to have the client send the alive
packet every 30 seconds to the server;
ServerAliveInterval 30
The other alternative is to manually set the ServerAliveInterval
option every time you’re connecting to a server by using the -o ServerAliveInterval=<time-in-second>
prefix as the following example;
$ ssh -o ServerAliveInterval=30 [email protected]
PDF or Portable Document Format the most used and probably the de-facto file format for document exchange. The format was created by Adobe Systems back in 1993 and Adobe Systems produces Adobe Acrobat to create and edit PDF files.
While being the most powerful tool for the purpose, Adobe Acrobat doesn’t currently run natively in Linux. One good alternative for Linux users is PDFEdit.
PDFEdit is the most complete PDFEditor for Linux. It’s QT based and the functions are accessible through theGUI based editor. The editing operations can also be scripted using the ECMAScript.
The program is installable in Ubuntu and Debian with the following command;
$ sudo apt-get install pdfedit
When launched, users can edit PDF files almost the same way as using any other desktop publishing application.
You will get the below error when logging in to phpMyAdmin
without password even if your actual MySQL
account itself is passwordless. This is because phpMyAdmin
is normally configured to disable passwordless login due to security reasons.
Login without a password is forbidden by configuration (see AllowNoPassword)
To enable passwordless MySQL
login in phpMyAdmin
, you’ll need to set AllowNoPassword
option in phpMyAdmin
‘s configuration to TRUE
.
To enable the option, uncomment or add the following line;
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
Depending on distributions, there could be multiple occurrences of that particular line. Ubuntu
for example has the following 2 lines;
if (!empty($dbname)) { // other configuration options $cfg['Servers'][$i]['AllowNoPassword'] = TRUE; // it should be placed before the following line $i++; } // other configuration options $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
Mplayer is initially a movie player for Linux, but through the many available options, it is capable of doing many other things, including to save, record or dump online music stream to file.
In it’s easiest form, running the following command will dump 1.FM’s Channel X (with more channels available from www.shoutcast.com) to current.mp3
$ mplayer -dumpstream http://64.62.252.130:8070 -dumpfile current.mp3
The following bash script takes this a little bit further by keeping the latest 3 dumps, and delete the older ones.
#!/bin/bash URL=http://64.62.252.130:8070 WORKDIR=/home/shakir/temp/mplayerdump MAXDUMP=3 CURRENTDUMP=`ls $WORKDIR | wc -l` mv $WORKDIR/current.mp3 $WORKDIR/`date +%F`.mp3 if [ $CURRENTDUMP -ge $MAXDUMP ] ; then for i in `ls $WORKDIR | head -n $[($CURRENTDUMP-$MAXDUMP)+1]`; do rm $WORKDIR/$i done fi mplayer -dumpstream $URL -dumpfile $WORKDIR/current.mp3
Going a little further is to run the script through cron nightly, for daytime listening probably while being mobile and offline. Crontab entry is editable by the following command;
$ crontab -e
and add the following line (assuming the script is located at /home/shakir/mplayerdump.sh)
0 2 * * * /home/shakir/mplayerdump.sh
Do make sure the script is executable by running the following command:
$ chmod a+x /home/shakir/mplayerdump.sh
The basic steps in accessing a MySQL database is normally to connect, execute statement, fetch result, and then to close the connection. The following is the steps translated into Python codes;
# Import required module import MySQLdb # Connect conn = MySQLdb.connect(host="localhost", port=3306, user="root", passwd="root123", db="mysql") cursor = conn.cursor( ) # Execute statement stmt = "SELECT * FROM user" cursor.execute(stmt) # Fetch and output the result result = cursor.fetchall( ) print result # Close connection conn.close( )
The requirement for this is to install the MySQLdb module for Python which is available from it’s project page at http://sourceforge.net/projects/mysql-python. The connect function creates a connection to the database based on the supplied parameters, and a cursor object is then created upon the connection object. The above example only show the execute and fetchall methods, and there many other available methods from the cursor object. The conn object calls the close method to close the connection to the MySQL server.
Java Runtime Environment
.
# yum install -y java-1.8.0-openjdk
Elasticsearch
repository to yum
.# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
/etc/yum.repos.d/elasticsearch.repo
.
[elasticsearch-6.x] name=Elasticsearch repository for 6.x packages baseurl=https://artifacts.elastic.co/packages/6.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md
Elasticsearch
package along with dependencies.
# yum install -y elasticsearch
Elasticsearch
if necessary by editing /etc/elasticsearch/elasticsearch.yml
.Elasticsearch
service.9200
and 9300
.
# firewall-cmd --permanent --add-port=9200/tcp # firewall-cmd --permanent --add-port=9300/tcp
# firewall-cmd --reload
Elasticsearch
service to automatically start during boot.
# systemctl enable elasticsearch
Elasticsearch
service.
# systemctl start elasticsearch
The service will take a while to start
$ curl 127.0.0.1:9200 { "name" : "8v4rGQI", "cluster_name" : "elasticsearch", "cluster_uuid" : "nkZIqfkpSyCdh_jg3nqWfw", "version" : { "number" : "6.2.2", "build_hash" : "10b1edd", "build_date" : "2018-02-16T19:01:30.685723Z", "build_snapshot" : false, "lucene_version" : "7.2.1", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" }
When plugging an iPhone to a Ubuntu machine for few times, the CPU becomes busy with 100% utilization.
This is due to some bugs which causes iphone-set-info
and sometimes gvfs-afc-volume-monitor
program to misbehave.
This is confirmed in Ubuntu 10.04
To fix this, run the following commands at the terminal
sudo killall -9 iphone-set-info sudo killall -9 gvfs-afc-volume-monitor
This will only kill the programs, and will not affect the iPhone’s charging.
This is an example page. It’s different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most …
Read More
It is crucial to optimize page load time as it helps with user experience (UX) and conversion. It's also important for SEO with Google now officially using Core Web …
Read More
One way to measure the success of a website is to know how much website traffic it receives. Traffic or visitors don't just flock to a website once it's …
Read More
Parking is currently unavailable. We'll be right back.
\n ")}errorParkingServicesDisabled(){this.message("\nServices for this domain name have been disabled.
\n ")}errorParkingNoSponsors(e){this.message(`\n \n \n ${window.location.hostname} currently does not have any sponsors for you.\n \n `,e)}imprint(e){if(!e)return;const t=document.querySelector("#imprint-text");t&&(t.innerHTML=e.replace(/(?:\r\n|\r|\n)/g,"${this.domain} currently does not have any sponsors for you.
`;case"disabled_mr":return`\nReferral traffic for ${this.domain} does not meet requirements.
`;case"js_error":return"\nParking is currently unavailable. We'll be right back.
\n ";default:return"\nServices for this domain name have been disabled.
\n "}}get trackingType(){switch(this.reason){case"disabled_rc":return"revenue_cap_reached";case"disabled_mr":return"invalid_referral";case"adblock":return"ad_blocked_message";case"no_sponsors":return"no_sponsors_message"}}get domain(){return window.location.hostname}toContext(){return{cannotPark:this.reason}}}function unpackPHPArrayObject(e,t){const n=e[t];if(n&&!Array.isArray(n))return n}class Parking extends State$2{constructor(){super(...arguments),this.type=Type.Parking}static build(e,t){const n=new Parking;n.domain=e.domainName,n.html=e.template,n.scripts=e.scripts||[],n.javascript=e.inlineJs,n.stylesheet=e.styles,n.imprint=e.imprintText;const i=unpackPHPArrayObject(e,"salesSettings"),s=(null==i?void 0:i.status)&&"NOT_FOR_SALE"!==(null==i?void 0:i.status);if(s){const{status:e,location:t,message:s,link:a,type:o}=i;n.salesBanner={message:s,href:a,position:t,theme:o,status:e}}return t.wantsToServeAds?n.trackingType="ctr":s&&window.location.pathname.startsWith("/listing")?n.trackingType="sales":n.trackingType="visit",n}toContext(){return{}}}class Sales extends State$2{constructor(){super(...arguments),this.type=Type.Sales}static build(e){const t=unpackPHPArrayObject(e,"salesSettings");if(!t)return;const{status:n}=t;return["NOT_FOR_SALE","EXTERNAL_MARKET","URL"].includes(n)?void 0:window.location.pathname.startsWith("/listing")?new Sales:void 0}toContext(){return{}}get trackingType(){return"sales"}init(e){window.context=e;const t=document.createElement("script");t.type="text/javascript",t.src=SALES_JS_URL,document.head.append(t)}}class Redirect extends State$2{constructor(){super(...arguments),this.type=Type.Redirect}static build(e,t,n){const i=unpackPHPArrayObject(e,"salesSettings"),{zeroClickDelay:s,skenzoRedirect:a,skenzoUrl:o,showInquiryForm:r,canZeroClick:d,cannotPark:c}=e;if(window.location.pathname.startsWith("/listing")&&["EXTERNAL_MARKET","URL"].includes(null==i?void 0:i.status)){if(null==i?void 0:i.external)return Redirect.toState(i.external,"sales");if(null==i?void 0:i.link)return Redirect.toState(i.link,"sales")}if(n.cannotLoadAds&&n.wantsToServeAds)return Redirect.toState(n.noAdsRedirectUrl,"no_ads_redirect");if(d&&(null==t?void 0:t.reason)){if(null==t?void 0:t.redirect)return Redirect.toState(t.redirect,"zc_redirect",s);if(a&&o)return Redirect.toState(o,"skenzo_redirect")}return(null==i?void 0:i.status)&&"NOT_FOR_SALE"!==(null==i?void 0:i.status)&&(n.cannotLoadAds||n.cannotLoadAds&&!d||r)?Redirect.toState(`${window.location.origin}/listing`):void 0}static toState(e,t,n=0){const i=new Redirect;return i.url=e,i.delay=n,i.trackingType=t,i}toContext(){return{}}}const browserState=()=>{var e,t,n,i,s;const{screen:{width:a,height:o},self:r,top:d,matchMedia:c,opener:l}=window,{documentElement:{clientWidth:h,clientHeight:u}}=document;let p;try{p=(new Date).getTimezoneOffset()/60*-1}catch(e){p=null}return{popup:!(!l||l===window),timezone_offset:p,user_preference:null===(e=null===Intl||void 0===Intl?void 0:Intl.DateTimeFormat())||void 0===e?void 0:e.resolvedOptions(),user_using_darkmode:Boolean(c&&c("(prefers-color-scheme: dark)").matches),user_supports_darkmode:Boolean(c),window_resolution:{width:null!=h?h:0,height:null!=u?u:0},screen_resolution:{width:null!=a?a:0,height:null!=o?o:0},frame:d===r?null:{innerWidth:null!==(t=null==r?void 0:r.innerWidth)&&void 0!==t?t:0,innerHeight:null!==(n=null==r?void 0:r.innerHeight)&&void 0!==n?n:0,outerWidth:null!==(i=null==r?void 0:r.outerWidth)&&void 0!==i?i:0,outerHeight:null!==(s=null==r?void 0:r.outerHeight)&&void 0!==s?s:0}}},TRACKING_URL="_tr",buildSignature=({callbacks:e,context:t},n)=>{var i,s,a,o;return Object.assign({ad_loaded_callback:null==e?void 0:e.adLoadedCallback,app_version:version,caf_client_id:null===(i=null==t?void 0:t.pageOptions)||void 0===i?void 0:i.pubId,caf_timed_out:null==e?void 0:e.cafTimedOut,caf_loaded_ms:null==e?void 0:e.cafLoadedMs,channel:null===(s=null==t?void 0:t.pageOptions)||void 0===s?void 0:s.channel,desktop:t.desktop,terms:null===(a=null==t?void 0:t.pageOptions)||void 0===a?void 0:a.terms,fd_server_datetime:t.fd_server_datetime,fd_server:t.fd_server,flex_rule:t.flex_rule,host:t.host,ip:t.ip,ivt:null===(o=null==t?void 0:t.pageOptions)||void 0===o?void 0:o.ivt,js_error:t.js_error,mobile:t.mobile,no_ads_redirect:t.noAdsRedirect,page_headers:t.page_headers,page_loaded_callback:null==e?void 0:e.pageLoadedCallback,page_method:t.page_method,page_request:t.page_request,page_time:t.page_time,page_url:t.page_url,reportable_channel:t.reportableChannel,reportable_style_id:t.reportableStyleId,tablet:t.tablet,template_id:t.templateId,type:n,user_has_ad_blocker:t.user_has_ad_blocker,user_id:t.userId,uuid:t.uuid,zeroclick:t.zeroClick},browserState())},trackVisit=({callbacks:e,context:t},n,i="")=>{const s=`${i}/${TRACKING_URL}`,a=i?"include":"same-origin",o=buildSignature({callbacks:e,context:t},n);let r={};"click"===n&&(r={click:"true",session:t.uuid,nc:Date.now().toString()}),fetch(s,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},credentials:a,body:JSON.stringify(Object.assign({signature:encode(o)},r))})};var State$1;!function(){if(!window.CustomEvent){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=window.Event.prototype,window.CustomEvent=e}}(),function(e){e[e.Pending=0]="Pending",e[e.Loaded=1]="Loaded",e[e.Failed=2]="Failed"}(State$1||(State$1={}));class Provider{constructor(e){this.timeoutSeconds=5,this.handlePixelEvent=e=>{switch(this.state){case State$1.Failed:break;case State$1.Pending:setTimeout((()=>this.handlePixelEvent(e)),100);break;case State$1.Loaded:this.onPixelEvent(e)}},this.watch=()=>{switch(this.state){case State$1.Loaded:case State$1.Failed:break;case State$1.Pending:this.isLoaded()?this.state=State$1.Loaded:this.isTimedOut()?this.state=State$1.Failed:setTimeout(this.watch,50)}},this.config=e,this.identifier&&this.identifier.length>0?(this.state=State$1.Pending,this.timeoutAt=new Date,this.timeoutAt.setSeconds(this.timeoutAt.getSeconds()+this.timeoutAfter()),this.injectPixel()):this.state=State$1.Failed}get identifier(){var e;return null===(e=this.config)||void 0===e?void 0:e.key}get pixelEvents(){var e;return null===(e=this.config)||void 0===e?void 0:e.pixel_events}injectPixel(){this.injectedAt||(this.injectedAt=new Date,this.inject(),this.watch())}inject(){const e=document.createElement("script");e.text=this.script,document.head.appendChild(e)}isTimedOut(){return+new Date>=+this.timeoutAt}timeoutAfter(){return this.timeoutSeconds}selectPixelEvents(e){if(Array.isArray(this.pixelEvents))return this.pixelEvents.filter((t=>"term-view"===t.trigger&&"visit"===e||(!(!["term-click","ad-view"].includes(t.trigger)||"ctr"!==e)||"ad-click"===t.trigger&&"click"===e)))}}class Facebook extends Provider{get script(){return`!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init', '${this.identifier}');`}onPixelEvent(e){this.selectPixelEvents(e).forEach((e=>{e&&(e.custom?window.fbq("trackCustom",e.event):window.fbq("track",e.event))}))}isLoaded(){return!!window.fbq}}class Outbrain extends Provider{get script(){return`!function(_window, _document) {var OB_ADV_ID = '${this.identifier}';if (_window.obApi) {var toArray = function(object) {return Object.prototype.toString.call(object) === '[object Array]' ? object : [object];};_window.obApi.marketerId = toArray(_window.obApi.marketerId).concat(toArray(OB_ADV_ID));return;}var api = _window.obApi = function() {api.dispatch ? api.dispatch.apply(api, arguments) : api.queue.push(arguments);};api.version = '1.1';api.loaded = true;api.marketerId = OB_ADV_ID;api.queue = [];var tag = _document.createElement('script');tag.async = true;tag.src = '//amplify.outbrain.com/cp/obtp.js';tag.type = 'text/javascript';var script = _document.getElementsByTagName('script')[0];script.parentNode.insertBefore(tag, script);}(window, document);`}onPixelEvent(e){this.selectPixelEvents(e).forEach((e=>{e&&window.obApi("track",e.event)}))}isLoaded(){return!!window.obApi}}class Revcontent extends Provider{get script(){return""}inject(){const e=document.createElement("script");e.src="https://assets.revcontent.com/master/rev.js",document.head.appendChild(e)}onPixelEvent(e){this.selectPixelEvents(e).forEach((e=>{e&&window.rev("event",e.event)}))}isLoaded(){return!!window.rev}}class Taboola extends Provider{get script(){return"window._tfa = window._tfa || [];!function (t, f, a, x) {if (!document.getElementById(x)) {t.async = 1;t.src = a;t.id=x;f.parentNode.insertBefore(t, f);}}(document.createElement('script'),document.getElementsByTagName('script')[0],'//cdn.taboola.com/libtrc/unip/1451879/tfa.js','tb_tfa_script');"}onPixelEvent(e){this.selectPixelEvents(e).forEach((e=>{e&&window._tfa.push({notify:"event",name:e.event,id:e.pixel_id})}))}isLoaded(){return Array.isArray(window._tfa)}}class Tiktok extends Provider{constructor(e,t){super(e),this.useAltTikTokEventsForAdsPlatformUser=t}get script(){return`!function (w, d, t) {w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i