Skip to content

Instantly share code, notes, and snippets.

View rahilwazir's full-sized avatar
🎯
Focusing (kinda)

Rahil Wazir rahilwazir

🎯
Focusing (kinda)
View GitHub Profile
@rahilwazir
rahilwazir / event.md
Last active April 2, 2017 12:52
Error for keyboard Event
*** Error in `./event': free(): invalid size: 0x0000000001d43ab0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x791fb)[0x7f38527fe1fb]
/lib64/libc.so.6(+0x8288a)[0x7f385280788a]
/lib64/libc.so.6(cfree+0x4c)[0x7f385280b2bc]
/lib64/libxcb.so.1(xcb_disconnect+0x4e)[0x7f38536e18fe]
./event(hook_run+0x2c7)[0x48a9d7]
./event(aEvent+0x2d)[0x48cacd]
./event(_cgo_8a93f66017ea_Cfunc_aEvent+0x17)[0x48d997]
@rahilwazir
rahilwazir / upload-file-via-scp.md
Last active May 5, 2017 06:43
Upload file via SCP

Full version:

$ scp -i ~/.ssh/id_rsa /path/to/file.zip user@111.111.111.111:/path/to/remote/dir

Short version:

Put this in your ~/.bashrc or ~/.zshrc

@rahilwazir
rahilwazir / mkgit-centos6.sh
Last active March 15, 2017 13:33 — forked from eyecatchup/mkgit-centos6.sh
Bash script to install the latest Git version on CentOS 6.x.
#!/usr/bin/env bash
# Install the latest version of git on CentOS 6.x
# Install Required Packages
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
sudo yum install gcc perl-ExtUtils-MakeMaker
# Uninstall old Git RPM
sudo yum remove git
@rahilwazir
rahilwazir / vmdk_vhdx.md
Last active March 3, 2024 22:01
Convert VMWare to Hyper-V (vmdk to vhdx)
@rahilwazir
rahilwazir / phpstorm_wp_style_guide.xml
Created December 2, 2016 09:43
PHPStorm WordPress style guide
<code_scheme name="wordpress">
<PHPCodeStyleSettings>
<option name="SPACE_AFTER_UNARY_NOT" value="true" />
</PHPCodeStyleSettings>
<codeStyleSettings language="PHP">
<option name="CLASS_BRACE_STYLE" value="1" />
<option name="METHOD_BRACE_STYLE" value="1" />
<option name="SPACE_WITHIN_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_METHOD_CALL_PARENTHESES" value="true" />
<option name="SPACE_WITHIN_METHOD_PARENTHESES" value="true" />
@rahilwazir
rahilwazir / wp_super_cache_dynamic_data.md
Last active December 5, 2016 09:49
WP Super Cache - Framentation (Dynamic data)

Dynamic Data

Example:

This is dynamic data replacement for EDD wallet plugin which uses [edd_deposit] shortcode called in post/page content.

define( 'TEST_EDD_DEPOSIT', '781e6e7d1d2735746aed85da550aac72' );

function test_dynamic_ob_test( &amp;$cachedata ) {
@rahilwazir
rahilwazir / import_csv_mysql.sh
Created November 24, 2016 07:01
Import list of CSV files in a directory to mysql, where each filename must be a table name
#!/usr/bin/env bash
# cd /your/directory/to/csvtables
for f in *.csv
do
mysqlimport --ignore-lines=1 \
--fields-terminated-by=, \
--fields-enclosed-by="\"" \
--fields-escaped-by=\
@rahilwazir
rahilwazir / refresh_wifi_network.md
Created November 21, 2016 14:49
Refresh WiFi network connection through CLI

Find your WiFi interface

$ ifconfig

In my case it's wlo1 and run

[root@localhost]# iwlist wlan0 scan
@rahilwazir
rahilwazir / connect_wifi_cli.md
Last active November 21, 2016 14:44
Connect to WiFi through CLI

List all wifi devices

$ nmcli c

Find your WiFi uuid and connect

$ nmcli c up uuid 
@rahilwazir
rahilwazir / post-merge
Created November 18, 2016 08:31 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"