Skip to content

Instantly share code, notes, and snippets.

@gryf
gryf / refres_jqgrid.patch
Created February 28, 2012 11:56
Single grid page, refresh problem patch
diff --git a/js/grid.base.js b/js/grid.base.js
index 9f324fb..6977292 100644
--- a/js/grid.base.js
+++ b/js/grid.base.js
@@ -837,19 +837,19 @@ $.fn.jqGrid = function( pin ) {
var div = rh * rn;
var page, npage, empty;
if ( tbot < dh && ttop <= 0 &&
- (p.lastpage===undefined||parseInt((tbot + scrollTop + div - 1) / div,10) <= p.lastpage))
@gryf
gryf / bash_prompt.sh
Last active April 20, 2018 07:59 — forked from bradsokol/bash_prompt.sh
Set color bash prompt according to active virtualenv, Git, Mercurial or Subversion branch and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the active nodejs virtualenv[1]
# * the branch/status of the current Git, Mercurial or Subversion repository
# * the return value of the previous command
# * one line prompt
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <version> <revision>"
echo "for example for Java 1.8.0.92 it would be:"
echo "$0 8 92"
exit 1
fi
VERSION="$1u$2"
@gryf
gryf / is-thursday.py
Last active October 12, 2016 08:22 — forked from dulek/is-thursday.py
#!/usr/bin/env python
import argparse
from datetime import datetime
from pytz import common_timezones, timezone
parser = argparse.ArgumentParser(description="Tells you if it's Thursday "
"anywhere in the world.")
parser.add_argument('--all', action='store_true', default=False,
help='Print all timezones with Thursday.')
@gryf
gryf / nbp-rates.py
Last active March 20, 2020 11:22 — forked from dulek/nbp-rates.py
Gets you average NBP rate for given date and currency.
#!/usr/bin/env python
"""
Get exchange rate from NBP service for USD (default) and provided day (or now)
"""
import argparse
from datetime import datetime
import requests
@gryf
gryf / suspend.sh
Created August 31, 2019 05:28
do actions before and after suspending
#!/bin/bash
xlock &
sudo /usr/sbin/pm-suspend
# get back keyboard and other settings after resume
#sudo /usr/local/bin/usb_power.sh
~/bin/setxinput.sh
@gryf
gryf / freedesktop_wmaker_menu.py
Last active February 24, 2020 18:15
example of dynamic window maker menu for freedesktop *desktop files.
#!/usr/bin/env python
import argparse
import configparser
from collections import defaultdict
import os
class WMMenu:
APP_DESK_PATH = '/usr/share/applications'
@gryf
gryf / copydeps.sh
Created February 25, 2020 05:26
Copy dependencies (libs) for certain binaries
DEPS=(/bin/foo /sbin/bar /usr/bin/baz)
# copy libs of foo/bar/baz to lib in current directory
for bin in ${DEPS[*]}; do
cp $bin ./bin/
ldd $bin >/dev/null || continue
for lib in $(ldd $bin | sed -nre 's,.* (/.*lib.*/.*.so.*) .*,\\1,p' \\
-e 's,.*(/lib.*/ld.*.so.*) .*,\\1,p')
do
mkdir -p .${lib%/*} && cp {,.}$lib
@gryf
gryf / tmux.md
Last active June 17, 2020 15:06 — forked from russelldb/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

import os
import subprocess
import weechat
info = ('notify',
'gryf',
'0.1',
'GPL3',