Skip to content

Instantly share code, notes, and snippets.

Avatar

Pavel Alexeev aka Pahan-Hubbitus Hubbitus

View GitHub Profile
@Hubbitus
Hubbitus / mount.afuse
Created Feb 11, 2017
Afuse sshfs automounter (/usr/sbin/mount.afuse)
View mount.afuse
#!/bin/bash
# afuse-sshfs mount helper to automatically mount remote machines.
# It is intended to be used as mount.afuse in command line. F.e. in /etc/fstab you may mount directory like:
# afuse# /mnt/remote afuse auto 0 0
# And then as regular user just do:
# $ cd /mnt/remote/user@remote.host/remote/path
# and folder /mnt/remote/user@remote.host will be mounted automatically!
#
# On Mac some also recommend add defer_permissions,noappledouble mount options.
View Rename files by pattern
find -type f -exec sh -c 'F=$( basename "{}" ); mv $F $(echo $F | sed -r "s/^([[:digit:]]+).+?/\1/")' \;
View strace.log
execve("/usr/bin/kcolorchooser", ["kcolorchooser"], [/* 75 vars */]) = 0
brk(NULL) = 0x5619369e1000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffbf6d20000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=271676, ...}) = 0
mmap(NULL, 271676, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ffbf6cdd000
close(3) = 0
open("/lib64/libKF5XmlGui.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p5\4\0\0\0\0\0"..., 832) = 832
@Hubbitus
Hubbitus / gist:42a00248e3f0012d6ebf
Last active Aug 29, 2015
Modularizing groovy config workaround
View gist:42a00248e3f0012d6ebf
// For structured comment of http://naleid.com/blog/2009/07/30/modularizing-groovy-config-files-with-a-dash-of-meta-programming
// SecurityConfigPlain.groovy
security {
includeScript( SecurityDefaults )
active = true
password = 'redefined'
}
// and then use (OtherClass.groovy):
View jsviews-dynamic-bind-handler
var template = $.templates({
specialistsTmpl: tmpl
});
$.templates.specialistsTmpl.link(container, {
specialists: list
}, {
onAfterCreate: function(view){
if (view.data instanceof Specialist){
console.log('onAfterCreate', view, view.data, view.tmpl.tmplName, view.data instanceof Specialist);
$(view.nodes()).find('.edit').click(
View gist:de2dec9602234252f843
Object to save test тест "test тест" main.js:98
Success set: ["test тест"], {"response":1} main.js:108
Success get: ["test ����"], {"response":"\"test ����\""} main.js:116
View gist:db86efb2c9529ccaabb2
Добрый вечер. У меня какая-то странная проблема с кодировкой (UTF-8) в storage.get/set.
Простой код:
var t = { en: 'test', ru: 'тест' };
console.log('Object to save', t, JSON.stringify(t));
VK.api(
'storage.set'
,{
key: 'test'
,value: JSON.stringify(t)
You can’t perform that action at this time.