Skip to content

Instantly share code, notes, and snippets.

View xtranophilist's full-sized avatar

Dipesh Acharya xtranophilist

View GitHub Profile
@xtranophilist
xtranophilist / transfer.py
Created October 19, 2012 11:20
Script to transfer a website from one host to another. Moves files with FTP and MySQL data with dumping and importing.
#!/usr/bin/python
#SSH into the new server, and run this from the home directory. Granted ~/public_html is the Apache DocumentRoot for
#the user
import getpass
import os
print '\nThis script will automate the process of moving a website from one server to another.'
@xtranophilist
xtranophilist / provinces_districts.json
Created April 10, 2018 09:03
Provinces and Districts of Nepal [WIP]
[
{
"province": "1",
"name": "Sagarmatha",
"districts": [
"Bhojpur",
"Dhankuta",
"Ilam",
"Jhapa",
"Khotang",
@xtranophilist
xtranophilist / ko-chosen.js
Last active January 11, 2019 23:42
Collection of Knockout.js custom bindings.
//http://stackoverflow.com/questions/13210663/how-to-order-knockout-bindings
ko.bindingHandlers.chosen = {
init: function(element, valueAccessor, allBindingsAccessor, viewModel) {
var allBindings = allBindingsAccessor();
var options = {default: 'Select one...'};
$.extend(options, allBindings.chosen)
$(element).attr('data-placeholder', options.default);
@xtranophilist
xtranophilist / _pagination.html
Last active January 17, 2019 10:03
Bootstrap 4 Pagination template for django-pure-pagination
{% load i18n %}
{% if is_paginated %}
<nav aria-label="navigation" class="p-3">
<ul class="pagination">
{% if page_obj.has_previous %}
<li class="page-item">
<a href="?{{ page_obj.previous_page_number.querystring }}"
class="page-link previous">&lsaquo;&lsaquo; {% trans "Previous" %}</a>
</li>
{% else %}
@xtranophilist
xtranophilist / install-mscorefonts.sh
Created December 27, 2012 14:28
Install 'Times New Roman' and other proprietary fonts in Fedora
yum install rpm-build cabextract ttmkfdir
wget http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec
rpmbuild -bb msttcorefonts-2.5-1.spec
rpm -ivh $HOME/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm
fc-cache -f -v
@xtranophilist
xtranophilist / dj_pagination_bootstrap4.html
Created April 13, 2017 09:49
Bootstrap 4 pagination template (partial) for dj-pagination
{% load i18n %}
{% if is_paginated %}
<nav aria-label="navigation" class="p-3">
<ul class="pagination">
{% if page_obj.has_previous %}
<li class="page-item">
<a href="?page={{ page_obj.previous_page_number }}" aria-label="Previous" class="page-link previous">
&lsaquo;&lsaquo; {% trans "Previous" %}
</a>
</li>
@xtranophilist
xtranophilist / install-b43.sh
Last active February 3, 2022 16:10
Install Broadcom (B43) wireless driver in Linux
#!/bin/bash
#http://wireless.kernel.org/en/users/Drivers/b43
su -
yum install b43-fwcutter wget # apt-get or whatever your package manager is
export FIRMWARE_INSTALL_DIR="/lib/firmware"
wget http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2
tar xjf broadcom-wl-5.100.138.tar.bz2
sudo b43-fwcutter -w "$FIRMWARE_INSTALL_DIR" broadcom-wl-5.100.138/linux/wl_apsta.o
echo 'modprobe b43' > /etc/sysconfig/modules/b43.modules
@xtranophilist
xtranophilist / sms
Created April 12, 2013 18:24
Android SMS backup/restore w/ adb
#Backup:
adb remount
adb pull /data/data/com.android.providers.telephony/databases/mmssms.db mmssms.db
#Restore:
adb remount
adb push mmssms.db /data/data/com.android.providers.telephony/databases/mmssms.db
@xtranophilist
xtranophilist / fonepay_verification.py
Created April 26, 2022 11:01
Fonepay transaction verification
import requests
import hashlib
import hmac
import base64
import json
from django.conf import settings
def base64(st):
return base64.b64encode(st.encode('utf-8')).decode('utf-8')
@xtranophilist
xtranophilist / pacman-keyring-fix.md
Created August 8, 2022 07:00
Pacman Fix: error: key "..." could not be imported | error: required key missing from keyring

One of the common errors after running updates on your Arch Linux system:

error: key "..." could not be imported
error: required key missing from keyring
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.

Fix: