Skip to content

Instantly share code, notes, and snippets.

View azophy's full-sized avatar
🏠
Working from home

Abdurrahman Shofy Adianto azophy

🏠
Working from home
View GitHub Profile
@azophy
azophy / toggle_proxy.php
Created November 28, 2016 09:01
togle_proxy.php - A little script to toggle apt proxy configuration
#!/usr/bin/env php
<?php
/*
* toggle_proxy.php
*
* Toggle proxy services for the follwing softwares:
* - apt
*
* Note: copy to /usr/local/bin or any $PATH location to make it
* accessible from anywhere. Dont forget to add executable permission to
@azophy
azophy / mytimer.py
Created December 6, 2016 06:25
A simple python-based timer along with some aditional features
#! /usr/bin/env python
''' A simple python-based timer along with some aditional features:
- log activity into simple anydbm database (defined by MYTIMER_FILE environment variable)
- display popup when time is up
This simple program was created as my way to practice my Python 2.7
programming skill.
By : Abdurrahman Shofy Adianto <azophy@gmail.com>
@azophy
azophy / postgre.md
Last active June 30, 2017 10:34
Postgres create user & db, grant all priviledge

Quick PostgreSQL query to create a username, a database, and than grant all priviledges of the database to the username

Login first: sudo -u postgres psql then:

CREATE USER username;
CREATE DATABASE dbname;
ALTER USER username WITH ENCRYPTED PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE dbname TO username;
@azophy
azophy / task_man.py
Created May 3, 2017 04:50
PySide : Example of adding QProgressBar inside QTableWidget
# coding: UTF-8
# modified from : https://gist.github.com/mojaie/6257249
import sys
from PySide.QtCore import *
from PySide.QtGui import *
title = [
"Task Name",
@azophy
azophy / pyside_custom_progress_bar.py
Last active May 15, 2017 07:10
Example of modifying PySide's QProgressBar format to show progress percentage to 2 decimals
from PySide.QtGui import *
from PySide.QtCore import *
"""
Custom ProgressBar with percentage displayed with 2 decimals after point
ref: http://stackoverflow.com/a/11694473/2496217
"""
class CustomProgressBar(QProgressBar):
def __init__(self,parent=None):
super(CustomProgressBar, self).__init__(parent)
@azophy
azophy / mysql_create_commands.md
Last active July 7, 2017 03:00
MySQL create new Database template commands

First, terminal commandsudo mysql -uroot -p then on mysql console:

create database monicadb;
CREATE USER 'monica'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL ON monicadb.* TO 'monica'@'localhost';
FLUSH PRIVILEGES;
exit
@azophy
azophy / upload.sh
Created July 7, 2017 04:27
Simple GitLab Bash automated upload script
#!/bin/bash
# SIMPLE GITLAB UPLOAD AUTOMATION SCRIPT
# AUTHOR : Abdurrahman Shofy Adianto [ azophy.github.io ]
# usage:
# - dont forget to make this script executable by running "chmod +x upload.sh"
# - the only argument is aditional branch to be included after merging develop, for example: master
lokasi=$(git branch | grep \* | cut -d ' ' -f2)
develop_branch='develop'
@azophy
azophy / ULTRA SHORT VIM QUICKREF.md
Created July 29, 2017 03:51
ULTRA SHORT VIM QUICKREF

vim nama_file.txt

  • enter "command mode" -> esc button
  • enter "insert mode" -> i
  • save current file -> :w
  • exit vim -> :q
@azophy
azophy / make.py
Created January 23, 2019 10:09
Python based Sphinx make file. Good for uniform make method across platforms
#!/usr/bin/env python
"""
Python script to run the build process on all environtment. Intended to be
replacement to Makefile and make.bat
idea : https://github.com/sphinx-doc/sphinx/issues/3196
Run:

Keybase proof

I hereby claim:

  • I am azophy on github.
  • I am azophy (https://keybase.io/azophy) on keybase.
  • I have a public key ASCfauksy4CWY9hrmlc4q5Yj3eHmq9Z0Kn1I0s96948aDwo

To claim this, I am signing this object: