Skip to content

Instantly share code, notes, and snippets.

View skorotkiewicz's full-sized avatar
💻
Programming

Sebastian Korotkiewicz skorotkiewicz

💻
Programming
View GitHub Profile
@skorotkiewicz
skorotkiewicz / where.sql
Created December 8, 2016 15:08
WHERE id between 8571 and 139109
DELETE FROM punbb_posts WHERE id >= 8571 AND id <= 139109;
DELETE FROM punbb_posts WHERE id between 8571 and 139109;
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
iptables -F -t nat
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
@skorotkiewicz
skorotkiewicz / gist:37573dce57caf0d4cf561b216a974f8e
Created December 8, 2016 15:09
Clone OpenSuse VirtualBox vm
Tested with OpenSuse 11.3
Before cloning, you will need to change some hdd stuff in fstab & menu.lst. Let's begin:
1) Start the vm to clone and login as root.
2) Get the info from your partitions:
opensuse11:~ # fdisk -l
@skorotkiewicz
skorotkiewicz / TrigMain.php
Created December 8, 2016 15:10
Trigonometry.php andTrigMain.php
<?php
include_once("Trigonometry.php");
header("Content-type: image/png");
function graphTrig()
{
$trig = new Trigonometry();
$setgraph = $trig->setGraph("cos");
@skorotkiewicz
skorotkiewicz / geturl.sh
Created December 8, 2016 15:11
Get URL and Images from website in Bash
wget -O - 'http://www.elektroda.pl/' | \
grep -o '<img src=['"'"'"][^"'"'"']*['"'"'"]' | \
sed -e 's/^<img src=['"'"'"]//' -e 's/["'"'"']$//'
wget -O - http://stackoverflow.com | \
grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | \
sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//'
@skorotkiewicz
skorotkiewicz / config.bash
Created December 8, 2016 15:12
init.d php-fastcgi start script in debian and nginx
#nano /etc/init.d/php-fastcgi
#usage: /etc/init.d/php-fastcgi start
(( EUID )) && echo "You need to have root priviliges." && exit 1
BIND=127.0.0.1:9000
USER=www-data
PHP_FCGI_CHILDREN=15
PHP_FCGI_MAX_REQUESTS=1000
PHP_CGI=/usr/bin/php-cgi
@skorotkiewicz
skorotkiewicz / title2url.html
Created December 8, 2016 15:13
Change Title to URL in CSS
<!-- demo http://jsfiddle.net/jy47X/1/ -->
<style>
a, div:hover span { display: none; }
div:hover a { display: block; }
</style>
<div>
<span>tralala</span>
<a href="">tradfdlala</a>
</div>
@skorotkiewicz
skorotkiewicz / pass.js
Created December 8, 2016 15:14
Reveal password with javascript
//Paste into url bar:
javascript:(function(){var s,F,j,f,i; s = ""; F = document.forms; for(j=0; j<F.length; ++j) { f = F[j]; for (i=0; i<f.length; ++i) { if (f[i].type.toLowerCase() == "password") s += f[i].value + "\n"; } } if (s) alert("Passwords in forms on this page:\n\n" + s); else alert("There are no saved passwords in forms on this page.");})();
@skorotkiewicz
skorotkiewicz / FriendlyURL.php
Created December 8, 2016 15:15
Friendly URL
<?php
function url_slug($str, $options = array()) {
// Make sure string is in UTF-8 and strip invalid UTF-8 characters
$str = mb_convert_encoding((string)$str, 'UTF-8', mb_list_encodings());
$defaults = array(
'delimiter' => '-',
'limit' => null,
'lowercase' => false,
'replacements' => array(),
@skorotkiewicz
skorotkiewicz / generator-htpasswd.php
Created December 8, 2016 15:16
.htpasswd generator webpage in php
Use this form to generate your encrypted htaccess password.
<form method="post" action="">
<p><input type="text" name="login" placeholder="Login" /></p>
<p><input type="text" name="password" placeholder="Password" /></p>
<p><input type="submit" value="Get" /></p>
</form>
<?PHP
// demo: http://tmp.itunix.eu/aLog.php