Skip to content

Instantly share code, notes, and snippets.

@njsubedi
njsubedi / Set Bikram Sambat Birthday to Employee
Created January 11, 2023 18:15
ErpNext HRMS Customizations for Nepal
This file has been truncated, but you can view the full file.
// Add a new field "Bikram Sambat Birthday" to the Employee. Then add the following "Client Script" to ErpNext.
frappe.ui.form.on('Employee', {
'date_of_birth' : function (frm) {
var ad2bs = {"1944-01-01":"2000/09/17","1944-01-02":"2000/09/18","1944-01-03":"2000/09/19","1944-01-04":"2000/09/20","1944-01-05":"2000/09/21","1944-01-06":"2000/09/22","1944-01-07":"2000/09/23","1944-01-08":"2000/09/24","1944-01-09":"2000/09/25","1944-01-10":"2000/09/26","1944-01-11":"2000/09/27","1944-01-12":"2000/09/28","1944-01-13":"2000/09/29","1944-01-14":"2000/10/01","1944-01-15":"2000/10/02","1944-01-16":"2000/10/03","1944-01-17":"2000/10/04","1944-01-18":"2000/10/05","1944-01-19":"2000/10/06","1944-01-20":"2000/10/07","1944-01-21":"2000/10/08","1944-01-22":"2000/10/09","1944-01-23":"2000/10/10","1944-01-24":"2000/10/11","1944-01-25":"2000/10/12","1944-01-26":"2000/10/13","1944-01-27":"2000/10/14","1944-01-28":"2000/10/15","1944-01-29":"2000/10/16","1944-01-30":"2000/10/17","1944-01-31":"2000/10/18","1944-02
@njsubedi
njsubedi / bikram-sambat-to-gregorian.json
Created September 1, 2022 19:56
Bikram Sambat to Gregorian Date Map and Vice Versa
This file has been truncated, but you can view the full file.
{"2000-09-17":"1944-01-01",
"2000-09-18":"1944-01-02",
"2000-09-19":"1944-01-03",
"2000-09-20":"1944-01-04",
"2000-09-21":"1944-01-05",
"2000-09-22":"1944-01-06",
"2000-09-23":"1944-01-07",
"2000-09-24":"1944-01-08",
"2000-09-25":"1944-01-09",
"2000-09-26":"1944-01-10",
@njsubedi
njsubedi / shinto
Created July 26, 2022 11:07
Enter into the shell of latest run docker container.
#!/bin/sh
LAST_CONTAINER_ID=$(docker ps | head -n 2 | tail -n 1 | awk '{print $1}')
docker exec -it $LAST_CONTAINER_ID /bin/sh
{
"Province 1": {
"name": "Province 1",
"districts": {
"bhojpur": {
"eng_name": "bhojpur",
"nep_name": "भोजपुर",
"palikas": {
"aamchowk gaunpalika": {
"nep_name": "आमचोक गाउँपालिका",
@njsubedi
njsubedi / debian-setup-powerdns-mysql-primary.sh
Last active February 15, 2022 16:59
Set up PowerDNS with MySQL backend on Ubuntu/Debian
#!/bin/bash
set -eoux pipefail
PDNS_VERSION=4.6
PDNS_VERSION_STRING=46
# Remember to replace these IPs with your secondary nameserver ip, and ensure tcp and udp port 53 is accessible from this primary
PDNS_SECONDARY_IPS=1.2.3.4,4,3,2,1
PDNS_THIS_PRIMARY_HOSTNAME=$(hostname)

Rules

.* Relative paths are ALWAYS resolved from where the script is run.

.* Not from the path of script file. Not from th path of sourced scripts, if any.

.* The absolute path of the folder where the current script is given by

"$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

.* Sourced scripts will have access to the variables declared in the parent script.

@njsubedi
njsubedi / encrypt_openssl.txt
Created May 15, 2019 09:25 — forked from crazybyte/encrypt_openssl.txt
File encryption using OpenSSL
For symmetic encryption, you can use the following:
To encrypt:
openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt
To decrypt:
openssl aes-256-cbc -salt -a -d -in encrypted.txt -out plaintext.txt
For Asymmetric encryption you must first generate your private key and extract the public key.
@njsubedi
njsubedi / config.json
Last active August 29, 2015 14:16 — forked from anonymous/config.json
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@njsubedi
njsubedi / GASC Issues
Created October 6, 2013 01:41
Issues about GASC License discussed in #hack4GoodKTM2013
GASC cannot be presented to the court of law.
Only based on mouth of trust, and within a circle.
The license is not "serious".
I can still sue people if they used my code. ;) But I won't for sure.
@njsubedi
njsubedi / tictactoe.html
Created May 30, 2013 07:14
This is a simple Two-player TicTacToe game developed by me using HTML and JS in one night. I could have used X and O instead of colors but I tried to make it different, hence made it worse. Anyways, it would give an idea to do similar stuff using HTML and Javascript.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="author" content="Nj Subedi" />
<meta name="http-equiv" content="charset: utf-8" />
<meta name="description" content="Tic Tac Toe game developed using HTML and Javascript. Simple- commented and uncompressed." />
<meta name="generator" content="Bluefish Editor (Ubuntu OS, Version 12.04 LTS)" />