Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View allanlaal's full-sized avatar

Allan Laal allanlaal

View GitHub Profile
@allanlaal
allanlaal / usr_bin_restore_chmod.bash
Created December 16, 2022 22:20
restore /usr/bin chmod
#!/bin/bash
chmod 775 /usr/bin/
chmod 777 /usr/bin/gnome-text-editor
chmod 755 /usr/bin/img_stat
chmod 777 /usr/bin/kotlinc-jvm
chmod 755 /usr/bin/mod
chmod 755 /usr/bin/libmcrypt-config
chmod 755 /usr/bin/systemd-nspawn
chmod 755 /usr/bin/nmblookup
@allanlaal
allanlaal / stackoverflow.js
Last active December 20, 2020 13:54 — forked from machavity/gist:420197ff9108e0b757c9bbb7d487f965
Userscript: hide both sidebars on ALL Stack Overflow sites
# 2020-12-20:
Moved to https://github.com/allanlaal/hide-stackexchange-sidebars [to get a stable userscript url and have multiple flavours]
@allanlaal
allanlaal / gist:5a203327cb712625c93c41dd8551f7b4
Created March 12, 2020 14:41
my 8 level (modifiers: Altgr, Shift, Caps) xkb keyboard layout 2020-03-12
// @desc AIS keyboard layout
// @author Allan Laal <allan.laal@gmail.com>
// @install Add Estonian keyboard layout. delete old Estonian keyboard layout
// project location: /afs/acn/infra./laptop./keyboard./layout.
// actual layout path: /usr/share/X11/xkb/symbols
// $ sudo ln -sf /afs/acn/infra./laptop./keyboard./layout./ee /usr/share/X11/xkb/symbols/ex
//
// DEPRECATED?: RELOAD layout: setxkbmap -option lv3:caps_switch -option lv5:ralt_switch -option terminate:ctrl_alt_bksp -layout 'ex' -symbols 'alcom'
// setxkbmap -layout 'ex' -symbols 'alcom' -v 10
var dynamicStyles = false;
var dynamicStylesCache = [];
var dynamicStylesLastId = 0;
/**
*
* @param ruleName string
* @param ruleContents array of key value pairs of CSS rules
@allanlaal
allanlaal / FF.toolbar.hide.keyconfig.js
Created September 14, 2014 21:31
Firefox: toggle visibility of toolbars (using KeyConfig)
// install the KeyConfig extension from http://mozilla.dorando.at/keyconfig.xpi and add this code as a new key
// First get all toolbars (that are not the tab bar)
var tbs = Array.filter(document.querySelectorAll('toolbar'), function (x) {
// remove // from the below line to keep showing the tabs toolbar:
//return x.id != 'TabsToolbar';
return true;
});
// For each toolbar
<?php
/**
* @desc MySQL restarter
* @example # /root/scripts/mysql_restarter.php >> /root/scripts/mysql_restarter.log
* @author Allan Laal <allan@permanent.ee>
* @since 2013-10-05
* @version DIRTY
*/
#!/bin/sh
WORKDIR=/root/subdomain_bugfix_daemon/
# I recommend using a dedicated MySQL user with only SELECT rights if you are paranoid:
user="root"
pass="YOUR MYSQL PASSWORD HERE"
db="zpanel_core"
(mysql -u "$user" -p"$pass" "$db" <<EOF
SELECT COUNT(*) AS total FROM x_vhosts
EOF
@allanlaal
allanlaal / currency.sql
Last active December 5, 2021 06:51
SQL table of World currencies (even some expired ones) Source: http://bcmoney-mobiletv.com/blog/2008/12/30/currency-codes-dropdown-and-sql-table/ Cleaned up a bit, uses InnoDB and iso currency code as the PRIMARY key
--
-- Table structure for table `currency`
--
CREATE TABLE IF NOT EXISTS `currency` (
`iso` char(3) CHARACTER SET utf8 NOT NULL DEFAULT '',
`name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`iso`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@allanlaal
allanlaal / countries.sql
Last active August 30, 2021 02:09 — forked from adhipg/countries.sql
uses InnoDB and UTF8, uses ISO2 code as the primary key
--
-- Table structure for table `country`
--
CREATE TABLE IF NOT EXISTS `country` (
`iso` char(2) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`nicename` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`iso3` char(3) COLLATE utf8_unicode_ci DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,