Skip to content

Instantly share code, notes, and snippets.

86937 isset
43159 echo
31697 empty
29252 substr
26146 count
24248 is_array
22572 strlen
19365 sprintf
18090 unset
16584 str_replace
@linxon
linxon / SecureSessionHandler.php
Created December 29, 2015 10:39 — forked from eddmann/SecureSessionHandler.php
Secure session handler implementation.
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
@linxon
linxon / gist:b39c64b306b81664de45
Created February 4, 2016 07:02
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@linxon
linxon / convert.sh
Created February 15, 2016 16:13 — forked from akost/convert.sh
Bash script for recursive file convertion windows-1251 --> utf-8
#!/bin/bash
# Recursive file convertion windows-1251 --> utf-8
# Place this file in the root of your site, add execute permission and run
# Converts *.php, *.html, *.css, *.js files.
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f |
while read file
do
@linxon
linxon / gist:0cd8d14ae36c419fc86739879f37c897
Created June 3, 2017 09:06 — forked from bonyiii/gist:884681
How to create diff file for gentoo ebuild patch

An example to patch unixODBC-2.3.0 on a 64bit machine to work with oracle 8.

First download unixODBC source. mkdir /tmp/unixODBC/source

Create two new folder. mkdir /tmp/unixODBC/patch/original mkdir /tmp/unixODBC/patch/unixODBC-2.3.0/DriverManager/

cp /tmp/unixODBC/source/unixODBC-2.3.0/DriverManager/SQLConnect.c /tmp/unixODBC/patch/original

Keybase proof

I hereby claim:

  • I am linxon on github.
  • I am linxon (https://keybase.io/linxon) on keybase.
  • I have a public key whose fingerprint is 2837 3A83 12A4 452D 084C 7DC9 9946 3CAB 4AF4 AF45

To claim this, I am signing this object:

@linxon
linxon / dnsbl.sh
Created November 12, 2017 10:29 — forked from agarzon/dnsbl.sh
DNS Black List - Linux shell script (improved from: http://www.daemonforums.org/showthread.php?t=302)
#!/bin/sh
# Check if an IP address is listed on one of the following blacklists
# The format is chosen to make it easy to add or delete
# The shell will strip multiple whitespace
BLISTS="
bl.score.senderscore.com
bl.mailspike.net
bl.spameatingmonkey.net
b.barracudacentral.org
@linxon
linxon / mysql_backup.sh
Created November 16, 2017 09:44 — forked from agarzon/mysql_backup.sh
Mysql Backup ALL databases
#!/bin/bash
TIMESTAMP=$(date +'%Y-%m-%d_%Hh%Mm')
BACKUP_FOLDER=/mnt/backup/mysql
MYSQL_USER=admin
MYSQL_PASS=`cat /etc/psa/.psa.shadow`
MAX_DAYS=15
DATABASES=`mysql --user=$MYSQL_USER -p$MYSQL_PASS -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema)"`
mkdir -p "$BACKUP_FOLDER"
@linxon
linxon / gist:4f4788b1a79ad631f4571db667b7a52a
Created January 21, 2018 16:45
Logrotate Configuation /etc/logrotate.conf/iptables
/var/log/iptables.log
{
rotate 7
daily
missingok
notifempty
delaycompress
compress
postrotate
invoke-rc.d rsyslog reload > /dev/null
@linxon
linxon / about:config.md
Created February 13, 2018 12:01 — forked from haasn/about:config.md
Firefox bullshit removal via about:config

Firefox bullshit removal

Due to the incessant swarm of complete and utter nonsense that has been forcing its way into Firefox over time, I've decided to start collecting my personal list of “must-have” about:config tweaks required to turn Firefox into a functional brower.

NOTE: Unfortunately this is somewhat out of date. The comments link to some resources that may be more up-to-date. Patches welcome.

WebSockets

These can be used for nefarious purposes and to bypass access restrictions.