Skip to content

Instantly share code, notes, and snippets.

View anatooly's full-sized avatar

Anatolii B anatooly

View GitHub Profile
@anatooly
anatooly / gist:3364496
Created August 15, 2012 23:04
Git pre-commit hook
#!/bin/bash
# Author: Anatooly <anatooly.com>
# Based on code by Nikolaos Dimopoulos
# Based on code by Remigijus Jarmalavicius
# Checks the files to be committed for the presence of print_r(), var_dump(), die()
# The array below can be extended for further checks
php_checks[1]="var_dump("
php_checks[2]="print_r("
sudo nano /etc/rc.local
sleep 15
chown anatooly /sys/kernel/debug/
chown anatooly /sys/kernel/debug/vgaswitcheroo/switch
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
exit 0
sudo nano /etc/fstab
sudo nano /etc/modprobe.d/rt2800pci.conf
options rt200pci nohwcrypt=1
sudo iwconfig wlan0 rate 54M
sudo apt-get install iftop
sudo iftop -i wlan0 # See Wi-Fi speed
@anatooly
anatooly / main.c
Last active February 16, 2019 19:34
Hide all gtk menu at all apps in ElementaryOS
/*
BUILD:
gcc -shared -fPIC `pkg-config gtk+-x11-2.0 --cflags --libs` -o libwinmenu.so main.c
gcc -shared -fPIC `pkg-config gtk+-x11-3.0 --cflags --libs` -o libwinmenu3.so main.c
INSTALLATION:
cp libwinmenu.so /usr/lib/gtk-2.0/modules/libwinmenu.so
cp libwinmenu3.so /usr/lib/gtk-3.0/modules/libwinmenu.so
echo 'export GTK_MODULES=winmenu' >> ~/.profile or similar
*/
<?php
// php json.php
$json = array(
"key1" => "value1",
"key2" => "value2",
"key3" => array(
"key4" => array(
"param1", "param2", "param3",
"param4", "param5", "param6"
)
// valac --thread --pkg json-glib-1.0 json.vala
using Json;
int main(string[] args) {
size_t length;
string json;
string[] std_fields = {
"param1", "param2", "param3",
"param4", "param5", "param6"
diff --git a/vapi/mysql.vapi b/vapi/mysql.vapi
index b0a0acb..fe217af 100644
--- a/vapi/mysql.vapi
+++ b/vapi/mysql.vapi
@@ -257,6 +257,35 @@ namespace Mysql {
public bool data_seek (ulong offset);
}
+
+ [CCode (cname = "MYSQL_BIND")]
// alac mysql.vala --pkg mysql --Xcc=-lmysqlclient
using Mysql;
int main (string[] args)
{
int rc = 0;
string host = "127.0.0.1";
<?php
$rc = 0;
$host = '127.0.0.1';
$user = 'root';
$password = '';
$database = 'test';
$port = 3306;
$socket = null;
@anatooly
anatooly / Default (Linux).sublime-keymap
Last active January 12, 2018 17:01
Key bindings Sublime Text 3 like PhpStorm 6
[
{ "keys": ["ctrl+shift+a"], "command": "show_overlay", "args": {"overlay": "command_palette"} },
{ "keys": ["ctrl+shift+n"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["ctrl+shift+alt+n"], "command": "goto_symbol_in_project" },
{ "keys": ["ctrl+b"], "command": "goto_definition" },
{ "keys": ["ctrl+alt+left"], "command": "jump_back" },
{ "keys": ["ctrl+alt+right"], "command": "jump_forward" },
{ "keys": ["ctrl+y"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },