Skip to content

Instantly share code, notes, and snippets.

View linxlunx's full-sized avatar

Linggar Primahastoko linxlunx

View GitHub Profile
# This is my configuration with 4K laptop and 1080p monitor in Linux
# When 4K laptop is connected with 1080p monitor, the monitor scale is not proportional
# The configuration is different when extended monitor is put on the left or right side, so we have to set the panning
if [ "$1" == "right" ]
then xrandr --output DP-1 --scale 2.0x2.0 --panning 3840x2160+3200+0 --fb 7040x2160 --right-of eDP-1
elif [ "$1" == "left" ]
then xrandr --fb 7040x2160 --output eDP-1 --panning 3200x1800+3840+0 --right-of DP-1 --output DP-1 --mode 1920x1080 --scale 2x2 --primary
else echo -e "Please choose the position, right or left\nUsage: $0 right|left\n"
fi
@linxlunx
linxlunx / worldometer_corona.py
Last active March 23, 2020 12:54
Parse statistic from worldometer (corona) to json
import requests
from bs4 import BeautifulSoup
from datetime import datetime
import json
# get page
page = requests.get('https://www.worldometers.info/coronavirus/').text
# convert to bs
bs = BeautifulSoup(page, 'html.parser')
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
@linxlunx
linxlunx / scrap.go
Created December 1, 2016 03:53
Scraping Implementation Using Channels
// Scraping implementation using channels
// go run scrap.go
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"sync"
@linxlunx
linxlunx / char_count.py
Created October 17, 2016 15:10
Count input characters
#!/usr/bin/env python
# only need a few minutes if I calm down
# aaarrrgggh
string = raw_input() + " "
texts = list(string)
final_texts = ""
x = 0
for num in xrange(len(texts)-1):
if texts[num] != texts[num+1]:
@linxlunx
linxlunx / hovercard.go
Created August 2, 2015 15:51
Twitter User Hovercard Endpoint
package main
import (
"fmt"
"log"
"io/ioutil"
"net/http"
"encoding/json"
"regexp"
"strings"
@linxlunx
linxlunx / lebaranbabes.py
Created July 18, 2015 04:35
#LebaranBabes
#!/usr/bin/env python
import urllib
import urllib2
import json
import oauth2 as oauth
class Lebaran:
def __init__(self):
# twitter access key
@linxlunx
linxlunx / searchAndCount.go
Created May 16, 2015 02:11
Search and Count Mentioned Users (Twitter)
package main
import (
"github.com/ChimeraCoder/anaconda"
"fmt"
"log"
"net/url"
"strings"
"sort"
"regexp"
@linxlunx
linxlunx / detik.go
Created May 8, 2015 06:39
Detikcom Crawler With Golang
package main
import (
"fmt"
"log"
"io/ioutil"
"net/http"
"encoding/xml"
"sync"
"encoding/json"
#!/usr/bin/python
# Captcha breaker for ziddu
# Need tesseract-ocr installed
# Need PIL and pytesser module installed
# usage:
# $ python ziddu.py ziddu.jpeg
# Tesseract Open Source OCR Engine v3.02.02 with Leptonica
# captcha: pswx5