Skip to content

Instantly share code, notes, and snippets.

View xtranophilist's full-sized avatar

Dipesh Acharya xtranophilist

View GitHub Profile
var inject_binding = function (allBindings, key, value) {
//https://github.com/knockout/knockout/pull/932#issuecomment-26547528
return {
has: function (bindingKey) {
return (bindingKey == key) || allBindings.has(bindingKey);
},
get: function (bindingKey) {
var binding = allBindings.get(bindingKey);
if (bindingKey == key) {
binding = binding ? [].concat(binding, value) : value;
@xtranophilist
xtranophilist / pass.ods
Last active April 22, 2024 08:45
LibreOffice Calc random password generator
=CONCAT(INT(RAND()*10), CHAR(48+RAND()*10), INT(RAND()*10),CHAR(65+RAND()*26),INT(RAND()*1000),CHAR(97+RAND()*26),INT(RAND()*1000))
@xtranophilist
xtranophilist / pacman-aria2.conf
Created July 8, 2015 13:16
pacman and aria2 configuration
# good balance between details and readability : https://bbs.archlinux.org/viewtopic.php?pid=1491879#p1491879 #archlinux
# vim /etc/pacman.conf
# XferCommand = echo Downloading %u ... && /usr/bin/aria2c --conf-path=/root/.aria2/pacman-aria2.conf %u
# /root/.aria2/pacman-aria2.conf
connect-timeout=30
max-tries=5
retry-wait=10
@xtranophilist
xtranophilist / .zshrc
Last active June 29, 2023 14:35
My zsh aliases
alias ..='cd ..'
alias cl="clear; ls"
alias ft='find / -type f -exec grep -i $1 {} +'
alias gp='git push'
alias gpp='git pull; git push'
alias gsc='gs; gca'
alias gscp='gs; gca; gp'
alias gu='git pull'
alias jj='java -jar'
alias k8000="fuser -k -n tcp 8000"
@xtranophilist
xtranophilist / Q1.md
Last active June 15, 2023 04:34
Quotes about FOSS, Programming, Software Design and Technology.

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

  • John Woods (Most probably)
@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:

@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 / 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 / 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 / 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>