• TIL: You Can Track Playing Time of Non-Steam Game


    Update: 2024-01-28 This trick NO longer work If you want to track your gaming session (and other application usage) on windows, give ProcrastiTracker a try. In linux I recommend Lutris. Original Article If you have non-steam game[0] added to steam launcher, one feature that missing is ability to track playtime. It turn out that you can simply move your non-steam game into steam library folder and it will recognize the game and add playtime tracking just fine.

  • I Give Up on Linux Gaming


    Over the last few years I’ve been using linux desktop as main workspace and upgrade it into relatively powerfull machine. Either for software development, data analysys, and gaming. Unfortunately the gaming part is the most painfull experience for me. It’s just unreliable to play games on linux environment. You never know if the game you try to play will run or not. Everytime I update my system (kernel update, driver update, application update) something just broke. The game refuse to start. I need to tinker it by checking the logs. Sometimes it works, most of the times it’s not. The most frustating part is controller rumble support. Playing racing game without rumble feedback is like missing half of the experience.

  • Build and Configure PHP with phpenv+php-build


    Step 1 - Install The Tools Install phpenv $ git clone https://github.com/phpenv/phpenv.git ~/.phpenv Install php-build as phpenv plugin $ git clone https://github/com/php-build/php-build.git ~/.phpenv/plugins/php-build Add phpenv into PATH (put into .profiles/.bashrc/.zshrc or something similar) export PATH="${HOME}/.phpenv/bin:{$PATH}" eval "$(phpenv init -)" Reload your shell / Re-open your terminal Step 2 - Update Definitions We need to update php-build definitions periodically to get the available php versions. $ cd ~/.phpenv/plugins/php-build $ git fetch $ git merge origin/master --ff Step 3 - Compiling $ PHP_BUILD_CONFIGURE_OPTS="--with-sodium --with-pgsql --with-pdo-pgsql --with-zip --with-json --with-xml --enable-fpm" \ PHP_BUILD_XDEBUG_ENABLE=off \ PHP_BUILD_INSTALL_EXTENSION="apcu=5.1.22 pcov=1.0.11" \ phpenv install 8.1.12 Step 4 - Switching Version # List installed versions $ phpenv versions # Switch into specific version $ phpenv global 8.1.12

  • Reclaim Video Memory for Headless Server


    I bought a Beelink SER3 mini pc for my home server. It has 8GB memory and 256GB storage. Barely enough for my use case to run several service such as vaultwarden, nextcloud, freshrss, plex media server and other thing. In the future I might want to install gitlab or youtrack. For that I need to upgrade the memory to atleast 16GB. The thing is, it come pre-installed with windows 11 and from the marketing material it is intended for lightweight desktop usage (office suite, watch video) and boasting to be able running at 4K resolution. No wonder that the allocated video memory from RAM is around 2GB. I notice that after replacing windows with archlinux the main memory only read as 5.xGB. I always thought that video memory is done by OS, it turn out I need to configure it in the BIOS. Here’s the setting

  • Scrapping Leaflet Marker Data


    This is a snippet to scrap data from leaflet map generated by https://sekolah.data.kemdikbud.go.id/index.php/Cpetasebaran/index/000000/ Select data you want to scrap Figure 1: Select data to be scrapped Open developer console on your browser and paste following code // Retrieve layers data as array let layers = Object.keys(map._layers).map((key) => map._layers[key]) // Filter with popup only let points = layers.filter((layer) => layer._popupHandlersAdded) // Do something with the results let results = points.map((point) => ({ coordinate: point.getLatLng(), data: point.getPopup().getContent() })) // Extract essentials data let processed = results.map((item) => { // Create dummy element for querying DOM const element = document.createElement('div') element.innerHTML = item.data const schoolId = element.querySelector('a').href.split('/').pop() let data = element.querySelectorAll('li') data = [...data].map((el) => { const result = el.textContent.replace('NPSN : ', '').replace('Alamat : ', '') return result }) data.push(schoolId) return { coordinate: item.coordinate, npsn: data[0], nama: data[1], alamat: data[2], id: data[3] } }) localStorage.setItem('results', JSON.stringify(processed)) Now we can retrieve the results from localStorage. Open Storage tabs, navigate to Local Storage, select and copy Figure 2: Copy from localStorage

  • Store Steam Library on Nas Server


    By default steam library will be installed to your home directory when installed on linux. Unfortunately my drive only 128GB, not enough to install most AAA title. Fortunately I have NAS server with large storage. It would be nice to put game library on this server. That way I can share it between linux and windows (hopefully). How To Create NFS share on your NAS. This is an example of my configuration. It can only be accessed from ip address 192.168.88.10 (my desktop pc). "/mnt/md0/games" 192.168.88.10(rw,async,insecure,no_subtree_check,no_root_squash) Mount your NFS share into local directory. You can use mount command or add entry on your /etc/fstab # /etc/fstab # ... 192.168.88.2:/mnt/md0/games /home/zackad/Games nfs defaults,noatime,users,exec 0 0 Make sure that you add exec at the end of option, otherwise steam will complain about your mount missing execute permission Open steam Settings -> Downloads -> Steam Library Folder

  • Configuring Beelink SER3 to Auto Start on Power Loss


    Power ON your mini-pc and press Del key on your keyboard until you enter BIOS mode. Navigate to Advanced tab Select AMD CBS menu Select FCH Common Options Select AC Power Loss Options Select your preferred mode when AC Power is loss. In my case I want it to auto turn on when AC power lost and the machine is powered on, so I choose “Previous”

  • Installing Aequilibrae plugin on QGIS linux


    Problem Depending on your current setup, you might not be able install and use Aequilibrae plugin out of the box. I have this problem on linux and macos system. It works flawlessly on windows system. Just follow the manual and you good to go. Solution It take me quite some time to figure it out what exactly the problem. Basically it come down to: missing dependency bug on download binaries functionality incompatible compiled binary version provided by plugin author Here the steps I do to fix this problem

  • Reset USB Connection Without Un-pluging on Linux


    I’ve been playing games on linux lately. Unfortunately most of them is windows game that I run using steam proton or wine. None of them has native support for linux and has some problem either when launching or terminating. In most cases I’m using either SIGKILL or SIGTERM to stop the process. Because of this ungracefull process ternimation my wireless xbox controller going caput and refuse to re-connect. The solution is easy, just unplug and re-plug the usb wireless receiver.

  • How To Run Windows Game with Vanilla Wine on Linux


    What Gaming on linux getting better and better in the last couple of years thanks to Steam and project like proton. This is my take on how to play windows game that doesn’t available on steam or some pirated version to try before buying. Ideally I would use proton to run windows game/application but I can’t make it work. Proton/steam always complaint about execute permission on mounted disk. I store most of my data on NAS server mounted with samba or NFS. Whatever tweak I use, steam wont recognize it as valid mount. I can’t even use my mounted NAS as steam library folder. This force me to ‘sacrifice’ litle space on my local drive to be used as steam library folder. Fortunately by using wine I can run whatever application/game stored in whatever directory/network mounted share.

  • Fixing Slow Boot After Turning Off Swap on Linux


    Why Turning-off swap? Most of the time I have terrible experience when using swap. Whenever I have Out Of Memory (OOM) error, my computer freeze and become unusable that I have to hard reset it. Other time when the swap is actively being used, it make my system become unstable and not responsive because the system trying to access data from the swap. It’s a slow process that sometime require a few minutes before I can kill some applications to reclaim some memory.

  • Re-Installing TerraMaster OS (TOS) After It Broke


    Why? After I update TerraMaster OS (TOS), I’m also installing some application that unfortunately got stuck on 50% progress for a long time. The application I want to install are Transmission (bittorent client) and Aria2 (multi protocol download client). Both of them got stuck at 50% progress. With no option to cancel installation process and getting impatient, I decide to reboot my server and all of sudden I can no longer able to access my server. Accessing web control panel got connection refused, accessing ssh also refused.

  • How to get simple stats from git repository


    Actual script This script will print commit stats grouped by author in the current git repository. Save into your PATH e.g ~/.local/bin/gstats and give it execute permission (chmod +x ~/.local/bin/gstats). #!/usr/bin/env sh echo "Generating simple stats for this repository" for author in $(git shortlog -s | cut -c8- | xargs) do echo -e "\nStats for \"$author\"" # Copied from: https://gist.github.com/eyecatchup/3fb7ef0c0cbdb72412fc git log --shortstat --author=$author \ | grep -E "fil(e|es) changed" \ | awk '{files+=$1; inserted+=$4; deleted+=$6; delta+=$4-$6; ratio=deleted/inserted} END {printf "Commit stats:\n- Files changed (total).. %s\n- Lines added (total).... %s\n- Lines deleted (total).. %s\n- Total lines (delta).... %s\n- Add./Del. ratio (1:n).. 1 : %s\n", files, inserted, deleted, delta, ratio }' - done Usage Navigate into your git repository and type gstats command, this will output something like this.

  • How to self hosting git with http server


    Goal Can list git repository similar to http://git.php.net Web insterface used only for public view, security is not a concern Easy to provision and tear down TL;DR Create directory where to store your repositories Run docker run -p 1234:1234 -v /your/repo:/srv/gitweb/repo zackad/gitweb -d Manual Steps Create a working directory mkdir git-webhosting cd git-webhosting Create Dockerfile with following content FROM ruby:2.6-alpine RUN apk add --no-cache git git-gitweb perl-cgi \ && mkdir -p /srv/gitweb/repo \ && cd /srv/gitweb \ && git init WORKDIR /srv/gitweb COPY entrypoint.sh /srv/gitweb/entrypoint.sh COPY gitweb_config-example.perl /srv/gitweb/gitweb_config-example.perl EXPOSE 1234 CMD './entrypoint.sh' Create an entrypoint file with following content #!/usr/bin/env sh if [ -z "$1" ]; then # Start gitweb server on port 1234 git instaweb --httpd=webrick # Override config file with example, you can override with your own config cp gitweb_config-example.perl ./.git/gitweb/gitweb_config.perl # Prevent container to exit tail -F .git/gitweb/access.log else exec "$@" fi Create configuration for gitweb and name it gitweb_config-axample.perl #!/usr/bin/perl our $projectroot = "/srv/gitweb/repo"; our $git_temp = "/srv/gitweb/.git/gitweb/tmp"; our $projects_list = $projectroot; our $projects_list_categories_group = 1; $feature{'remote_heads'}{'default'} = [1]; Build the docker image with docker build git-hosting:latest . Start container with docker run -p 1234:1234 -v /your/repo/path:/srv/gitweb/repo git-hosting:latest -d Open your browser and access http:127.0.0.1:1234 Now you can add your projects into /your/repo/path/ and it will be automatically updated in web interface Further Action You can add this container into your server with some reverse proxy to add SSL for secure access. My main purpose of this system if for mirroring and peace of mind knowing that I can host all my project in an environment where I have total control.

  • Python For Beginner (Not Really Beginner!)


    WARNING: This article is not for beginner in programming, but for python beginner. If you want to learn python as your second (or 3rd, 4th, nth, …) language, this guide will give you some advice to manage your code and project structure. Preview Step 1 — Choosing Python Version Depending on your operating system, python might already installed. Try to type python --version on your terminal and see which version is installed. Sometime multiple version of python is installed in a single machine (version 2 and version 3). You can check by typing on your terminal

  • Migrate Blog System From Jekyll To GatsbyJS


    Spoiler Alert: NO, I DON’T For something that simple like blog system, the complexities of moving from jekyll to gatsby is not woth it. Here the reason why I’m considering migrating my blog system: I don’t use ruby I’m familiar with javascript and react The reason why I don’t migrate: For static content like blog, I would like to avoid javascript if possible Migrating process is painfull that I give up midway The generated artifact is too large (gatsby => 2.5Mb, jekyll => 500Kb)

  • How to Select Fastest Ubuntu Repository Mirror


    Ubuntu has so many mirror repository we can choose. Sometimes the mirror exists in our country that near with our internet provider. Update Thank to this answer on askubuntu.com we can automatically select fastest (maybe) mirror based on our geographic location. This configuration will automatically select best mirror based on our geographic location. However, this doesn’t necessary mean the fastest server. Add following entry at the top of /etc/apt/source.list file. You may delete other entry if you wish.

  • Using Gulp To Automatically Run PHPUnit Test After Saving File


    One of the most annoying as developer/programmer is to do repetitive task over and over again. Why not just automate it? We are programmer right? It’s our job to solve this kind of problem. The usual workflow of testing with phpunit is write test -> run phpunit -> edit source -> run php unit -> repeat. As we can see, in a single cyclus we run phpunit twice just to check if our source is passing the test. What if after editing the source the test is still failed? We need to edit the source and run phpunit again to check if the test is passing. This kind of repetitive task of cource can be automated right?

  • Menghitung Usability Factor Arah Runway Bandara dengan MySQL Database


    Salah satu tahap dalam perencanaan bandara adalah menentukan arah runway dengan memperhatikan kondisi angin di lokasi. Dalam artikel singkat ini akan dijelaskan bagaimana menghitung usability factor dengan menggunakan database sebagai alat bantu analisis. Apa saja yang dibutuhkan? Data arah angin selama 5 tahun terakhir sesuai dengan yang disyaratkan oleh ICAO (International Civil Aviation Organisation). Data ini bisa diperoleh di stasiun pengamatan BMKG terdekat dengan lokasi. MySQL database sebagai alat bantu analisis MySQL client sebagai antar muka (interface) user dengan system database. (HeidiSQL, MySQL Workbench) Tahap 1 — Mempersiapkan dan memformat database Pada tahap ini, kita akan mempersiapkan tabel sebagai tempat penyimpanan data. Adapun tabel yang dibutuhkan meliputi :

  • Dengerin Spotify Tanpa Iklan Di PC (No crack, no premium)


    Inilah cara paling mudah dengerin spotify tanpa terganggu iklan. Tanpa instal software tambahan, tanpa upgrade ke premium, dan tanpa bajak akun punya orang lain. Disclaimer: cara ini tidak mengaktifkan fitur premium yang lain seperti offline mode, high quality streaming, dll. Daftar host list yang akan di blok Buka web browser dan akses https://github.com/zackad/dotfiles/blob/master/hosts.d/ads_spotify.conf atau klik disini Copy isi file tersebut (kurang lebih seperti dibawah ini) # BLock ads host for spotify # host list taken from https://www.reddit.com/r/Piracy/comments/4kn6rq/comprehensive_guide_to_blocking_ads_on_spotify/ 127.0.0.1 adclick.g.doublecklick.net 127.0.0.1 adeventtracker.spotify.com 127.0.0.1 ads-fa.spotify.com 127.0.0.1 analytics.spotify.com 127.0.0.1 audio2.spotify.com 127.0.0.1 b.scorecardresearch.com 127.0.0.1 bounceexchange.com 127.0.0.1 bs.serving-sys.com 127.0.0.1 content.bitsontherun.com 127.0.0.1 core.insightexpressai.com 127.0.0.1 crashdump.spotify.com 127.0.0.1 d2gi7ultltnc2u.cloudfront.net 127.0.0.1 d3rt1990lpmkn.cloudfront.net 127.0.0.1 desktop.spotify.com 127.0.0.1 doubleclick.net 127.0.0.1 ds.serving-sys.com 127.0.0.1 googleadservices.com 127.0.0.1 googleads.g.doubleclick.net 127.0.0.1 gtssl2-ocsp.geotrust.com 127.0.0.1 js.moatads.com 127.0.0.1 log.spotify.com 127.0.0.1 media-match.com 127.0.0.1 omaze.com 127.0.0.1 open.spotify.com 127.0.0.1 pagead46.l.doubleclick.net 127.0.0.1 pagead2.googlesyndication.com 127.0.0.1 partner.googleadservices.com 127.0.0.1 pubads.g.doubleclick.net 127.0.0.1 redirector.gvt1.com 127.0.0.1 s0.2mdn.net 127.0.0.1 securepubads.g.doubleclick.net 127.0.0.1 spclient.wg.spotify.com 127.0.0.1 tpc.googlesyndication.com 127.0.0.1 v.jwpcdn.com 127.0.0.1 video-ad-stats.googlesyndication.com 127.0.0.1 weblb-wg.gslb.spotify.com 127.0.0.1 www.googleadservices.com 127.0.0.1 www.googletagservices.com 127.0.0.1 www.omaze.com Note: Untuk daftar list yang uptodate, cek disini.

  • How to Extend Line with ArcGIS


    Example of how to extend line feature (eg. road digitation) in order to cleanup the dangels using ArcGIS 10.1. import arcpy arcpy.env.workspase = "path/to/workspase" arcpy.ExtendLine_edit("dataset.shp", "distance", "EXTENSION") Extend Line Example (Stand-alone script) Clean up street centerlines that were digitized without having set proper snapping environments. # Name: ExtendLine.py # Description: Clean up street centerlines that were digitized without having # set proper snapping environmnets # Author: ESRI # Import system modules import arcpy from arcpy import env # Set environments settings env.workspase = "C:/data" # Make backup copy of streets feature class, since modification with the Editing tools below is permanent streets = "street.shp" streetsBackup = "C:/output/streetsBackup.shp" arcpy.CopyFeatures_management(streets, streetsBackup) # Trim street lines to clean up the dangles arcpy.TrimLine_edit(streets, "10 Feet", "KEEP_SHORT") # Extend street lines to clean up the dangles arcpy.ExtendLine_edit(streets, "15 Feet", "EXTENSION") Reference help file of ArcMap 10.1

  • SQL Function to Check Crosswind


    A simple function to check if a wind component is crosswind for airport runway direction planning. Using MySQL as database engine and analysis tool, this function can help to simplify checking usability factor of runway direction with given meteorogical data. DROP FUNCTION IF EXISTS `is_crosswind`; DELIMITER // -- Check if wind component is a crosswind to runway direction based on tresshold value CREATE FUNCTION `is_crosswind`( `tresshold` DOUBLE, -- Knot `runwayDirection` DOUBLE, -- Degree `windDirection` DOUBLE, -- Degree `windSpeed` DOUBLE -- Knot ) -- Return 1 if crosswind, 0 if not RETURNS integer(1) LANGUAGE SQL DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER COMMENT '' BEGIN declare angelDeg double; declare angelRad double; declare crossWind double; -- Calculate minimum angel between 2 crossing line -- https://math.stackexchange.com/questions/341749/how-to-get-the-minimum-angle-between-two-crossing-lines set angelDeg = abs(abs(`runwayDirection` - `windDirection`) - 180); -- convert angel Degree to Radian set angelRad = (pi()/180) * angelDeg; set crossWind = sin(angelRad) * `windSpeed`; if crossWind > `tresshold` then return 1; else return 0; end if; END // DELIMITER ;

  • Configuring Mapserver With NGINX Using Fast CGI


    Mapserver is an Open Source platform for publishing spatial data and interactive mapping application to the web. In this tutorial we will using nginx as reverse proxy to forward request to mapserver cgi process in the backgraound. Prerequisites Mapserver (available in ubuntu main repository 16.04 and above) nginx webserver This tutorial assuming that mapserver is installed in as /usr/bin/mapserv, if your mapserver installed in different path, please adapt accordingly. Configure Mapserver as cgi worker with spawn-fcgi Install spawn-fcgi if not already installed.

  • How To Install Allmark - The Markdown Webserver


    allmark is a fast, standalone markdown web server for Linux, Mac OS and Windows written in go. allmark is a file-system-centric markdown web server. You can point it at any directory that contains markdown files and it will immediately start a web-server that serves the rendered HTML content of the markdown file to you. Step 1 — Installing allmark webserver Download the binary file from this page Select the right version based on your system. If you use desktop computer, you may have 64bit system Use chmod to add execute permission. Copy the downloaded file to /usr/local/bin/allmark All that step can be written to

  • How to Setup Android Development Environment With React Native on Ubuntu 16.04


    Getting started with android development using react-native. Warning : This article may contain outdated/inacurate information. Please refer to latest documentation. In this guide, we won’t install android studio since we will use standard text editor such as atom, sublime text or even gedit. There’s no need to install full blown IDE to develop android with react-native. Since all the necessacy tool and process will be using command line. That’s why we want to install minimal amount of tool to save more storage space. Not only that, we won’t install android virtual device (avd) to save more space and use actual device as testing and debug device.

  • SQL Function to Generate Wind Direction


    Based on Robert Sharp answer on stack overflow question, this function is tested on MySQL version 5.7. DELIMITER // -- Using single parameter to determine wind direction name -- with angel is in decimal or integer CREATE FUNCTION `get_wind_direction`(`angel` DOUBLE) -- Return value as varchar RETURNS varchar(5) CHARSET utf8 LANGUAGE SQL DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER COMMENT '' BEGIN if `angel` < 0 then set `angel` = `angel` % 360 + 360; else set `angel` = `angel` % 360; end if; return case when `angel` between 0 and 11.25 then 'N' when `angel` between 11.25 and 33.75 then 'NNE' when `angel` between 33.75 and 56.25 then 'NE' when `angel` between 56.25 and 78.25 then 'ENE' when `angel` between 78.25 and 101.25 then 'E' when `angel` between 101.25 and 123.75 then 'ESE' when `angel` between 123.75 and 146.25 then 'SE' when `angel` between 146.25 and 168.75 then 'SSE' when `angel` between 168.75 and 191.25 then 'S' when `angel` between 191.25 and 213.75 then 'SSW' when `angel` between 213.75 and 236.25 then 'SW' when `angel` between 236.25 and 258.75 then 'WSW' when `angel` between 258.75 and 281.25 then 'W' when `angel` between 281.25 and 303.75 then 'WNW' when `angel` between 303.75 and 326.25 then 'NW' when `angel` between 326.25 and 348.75 then 'NNW' else 'N' end; END // DELIMITER ; Example :

  • List of Important Articles or Tutorials


    A currated list of usefull/awesome tutorials and guides found on the internet. Arduino and Electronics Getting Started with LCD 16x2 character LED with or without resistor Javascript Understand JavaScript Callback Functions and Use Them Callback hell Setup ReactJS with Webpack Awesome Data Visualization with D3.js PHP PDO Cheat Sheet Create Your Own Framework With Symfony Components Guide of Test Driven Development Create Wordpress Theme From Scratch Miscellaneous Vim Cheat Sheet Installing Arch Linux Travis-CI SSH Deploy Change Expiration Date of GPG Key Adblock Rules Explained Compose Key Cheat Sheet Dark Theme Save The World Tracking Dotfiles With Git Programmer Jokes [Solved] Spotify Ubuntu Can’t Play Local File

  • Customizing Bash Terminal - A Backup Snippet


    Add Git Branch Name Into PS1 parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } export PS1="\[\033[01;32m\]\u\[\033[00m\]@\[\033[01;34m\]\h\[\033[01;30m\]\$(parse_git_branch)\[\033[00m\]: " Preview Inside Git Repostory Show Current Directory in Title Bar PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' Preview Current Directory on Title Bar Instead of showing full path in title bar (PROMPT_COMMAND), we will replace our home directory name with ~ character. First we need to get current path with variable PWD, then replace home directory name with ~ character.

  • How To Create Secure WebSocket With Node.JS "ws" Module


    In this tutorial, we will create ssl enable websocket using ws module. Requirements nodejs with npm certbot to generate ssl certificate from letsencrypt Step 1 — Generating SSL Certificate Assuming you use ubuntu 16.04 the step are following sudo add-apt-repository ppa:certbot/certbot sudo apt-get update sudo apt-get install certbot If you’re using different system, please refer to this official documentation. After certbot successfully installed, we can generate ssl certificate with command sudo certbot certonly --webroot -w /var/www/html -d example.com -d www.domain.com Otherwise, if we don’t want to use webroot plugin we can use –standalone flag to generate ssl certificate.

  • How To Query Previous And Next Item From SQLite Table


    Let say we have data like this. id title 1 Vessel, Landmark Baru Manhattan 2 Seperti Apa Rasanya Memiliki Rumah “di Bawah” Batu? 3 Museum Gempa Di China Berbentuk Menyerupai Retakan Tanah 4 Menyusuri Jejak Budaya Peranakan di Rumah Kayu Goen 5 Tips Agar Material Semen Ekspos Terlihat Lebih Menarik 6 Ciptakan Nuansa Alam Dengan Material Bata Ekspos 7 Mengagumi Keindahan Arsitektur Kolonial Istana Cipanas 8 5 Cara Atasi Masalah Plafon Melendut 9 Di dalam Hotel Ini Ada Batu! 10 Tips Memilih Papan Gipsum Yang Berkualitas Now we want to select an item with id 4 and its previous and next item from that order (off course the real order depends on our real query). We can use union to get the current item (id=4), previous item (id=3), and next item (id=5) and the query become like this

  • How To Resize Tabs Character Output from "cat" comand


    This command will resize tabs size into 4 character. cat filename | expand -t4 Change -t4 with whatever size you want e.g -t8 for tabs with 8 character.

  • How To Tunneling MySQL Server


    For security reason, usually (and it should) root access won’t be allowed from remote address. So how do we can access mysql server using root credential from remote address? The usual way is, we access our remote server via ssh then access mysql from command line (shell). The problem is, with this method we can’t use graphical mysql client such as Mysql Workbench (assuming we run headless server). So how do we access mysql with root credential securely?

  • My .vimrc Config


    A little backup for my .vimrc config file. Other dotfiles can be found in this repository. " enable syntax highlighter syntax on " show line number set number " disable line wrap set nowrap " resize tab to 4 character set expandtab ts=4 sw=4 ai

  • How To Create Direct Link From Dropbox


    It’s easy to create direct link into file uploaded to Dropbox. Here’s how to do it. Login to your Dropbox account Navigate to file manager Select which file we want to share Click Share button Click Create Link Now we can copy the generated link All we need to do is to change last parameter to prevent preview mode by Dropbox. The copied link would look like this https://www.dropbox.com/s/42uao1de2rfkgcs/01.%20AdministrasiKota.KML?dl=0 change this part ?dl=0 to ?raw=1 so the link become like this

  • NodeJS Permission Denied When Installing "sqlite3" Module


    I’m trying to create a nodejs app using sqlite as database storage. The problem is I got error message that looks like this ... > node-pre-gyp install --fallback-to-build sh: 1: node-pre-gyp: Permission denied npm ERR! Linux 3.16.0-30-generic npm ERR! argv "node" "/usr/bin/npm" "install" npm ERR! node v0.10.33 npm ERR! npm v2.5.0 npm ERR! code ELIFECYCLE ... At a glance this seems to be simple permission error. But even after using sudo command I still got error when trying to run the app. Even though sqlite3 module got successfully installed, the error occurred when trying to run the app.

  • How To Add PPA Repository Manually Without "add-apt-repository" On Ubuntu


    The easiest way to adding ppa (Personal Package Archive) into ubuntu (and it’s variant) repository is to use add-apt-repository. Unfortunately this tool sometime is not installed in the system especially on minimalist distribution such as docker image. The good news is, we can add it manually. Step 1 — Adding PPA link to source list Visit ppa to search witch ppa we want to add to our system. Use the search menu to find the ppa we want.

  • Getting Started With Python Websocket Client


    The main purpose of this article is for archive and personal blog about what I’m doing in my work. For more info and best practice, I suggest you should visit official website of pypi. I’m not familiar with python, but since I need to use python with my raspberry pi project I think this is a good chance to getting started. In my case, I need to transmit data from sensor that connected to GPIO to online server so that other people can monitor the what the current status of my sensor. Originally I will using http protocol to send data from raspberry pi via curl but this won’t work if we want to get realtime data since there will be too much latency. Then again this won’t be efficient if we have to sending data with say, 10 second interval?

  • Disable Password Login on SSH


    The purpose of this configuration is to disable ssh login using password and force user to use ssh-key pair instead. Open /etc/ssh/sshd_config file using text editor and change following option. PermitRootLogin no # prevent root login via ssh PasswordAuthentication no # deny ssh login using password PubkeyAuthentication yes # enable public key authentication # Explicitly define which user can login via ssh (optional) # AllowUsers root otheruser Note: if the option is commented, delete ‘#’ at the start of line to enable the option.

subscribe via RSS