Skip to content

Instantly share code, notes, and snippets.

View ausuwardi's full-sized avatar

Agustianes Umbara Suwardi ausuwardi

View GitHub Profile
@ausuwardi
ausuwardi / shell-python.nix
Last active May 25, 2023 05:05 — forked from cdepillabout/shell.nix
shell.nix for Python development using virtualenv and pip
let
nixpkgs-src = builtins.fetchTarball {
# 22.11
url = "https://github.com/NixOS/nixpkgs/archive/nixos-22.11.tar.gz";
};
pkgs = import nixpkgs-src {
config = {
# allowUnfree may be necessary for some packages, but in general you should not need it.
allowUnfree = false;
@ausuwardi
ausuwardi / spacemacs-keybindings.md
Created August 17, 2021 22:53 — forked from rnwolf/spacemacs-keybindings.md
spacemacs keybindings that i need to learn
@ausuwardi
ausuwardi / logging.py
Created June 13, 2019 04:36 — forked from kingspp/logging.py
Python Comprehensive Logging using YAML Configuration
import os
import yaml
import logging.config
import logging
import coloredlogs
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'):
"""
| **@author:** Prathyush SP
| Logging Setup
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
from argparse import ArgumentParser
parser = ArgumentParser(description="Recompute parent_left, parent_right")
parser.add_argument('odoo_basedir')
parser.add_argument('odoo_cfg')
parser.add_argument('odoo_db')
parser.add_argument('model', help='Odoo model, e.g. account.account')
@ausuwardi
ausuwardi / concurrent_error.sh
Created July 7, 2017 06:45
Count 'concurrent update' error in postgresql, sum per hour
zcat /var/log/postgresql/postgresql-9.6-main.log.3.gz | grep 'due to concurrent update' | awk 'BEGIN {time="--"; count=0} {x=substr($2,1,2); if (time !=x) {printf "%s,%d\n", time, count; time=x; count=0;} count=count+1;} END {printf "%s,%d\n", time, count}'
@ausuwardi
ausuwardi / list_running_odoo_proc.sh
Last active July 7, 2017 04:18
List running odoo process
ps -eo stat,cmd,size | grep -E '^R\s+python /odoo/odoo-server.*'
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
@ausuwardi
ausuwardi / gist:1711170
Created January 31, 2012 15:46
Print bar code with ESCP printers
*
* TestBC.prg
*
* Test printing barcode
*
#DEFINE BCT_EAN13 0
#DEFINE BCT_EAN8 1
#DEFINE BCT_INT25 2
#DEFINE BCT_UPCA 3