Skip to content

Instantly share code, notes, and snippets.

View kiler129's full-sized avatar

Gregory House kiler129

  • noFlash
  • Chicago, IL (USA)
View GitHub Profile
@kiler129
kiler129 / troll.vbs
Created July 19, 2015 00:20
Wana troll you work colleague? Let's run that script on his computer :) It will lock his workstation in random time intervals.
do
wscript.CreateObject("WScript.Shell").Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"
Randomize
wscript.sleep Int((1200000-600000+1)*Rnd+600000)
loop
@kiler129
kiler129 / test.php
Created August 12, 2015 18:33
Hashing password via PHP or MySQL
<?php
//This is only demonstration of really bad bad bad password storing idea - do NOT ever use that.
//Test was used only to prove that hashing on database is not only less secure but slower.
define('NUMBER_OF_USERS', 50000);
define('PASSWORD_LENGTH_FROM', 10);
define('PASSWORD_LENGTH_TO', 100);
/*
Database
--------
@kiler129
kiler129 / cloudflare_update.script
Last active October 11, 2023 09:10
Automatic script for Mikrotik RouterOS updating record on CloudFlare.
#########################################################################
# ================================================== #
# $ Mikrotik RouterOS update script for CloudFlare $ #
# ================================================== #
# #
# - You need a CloudFlare account & api key (look under settings), #
# a zone and A record in it #
# - All variables in first section are obvious, except CFid, #
# To obtain CFid use following command in any unix shell: #
# curl https://www.cloudflare.com/api_json.html -d 'a=rec_load_all' -d 'tkn=YOUR_API_KEY' -d '[email protected]' -d 'z=domain.com'|python -mjson.tool
@kiler129
kiler129 / gist:0bad4b46b70e2735ec40
Created September 3, 2015 11:06
PHP 7.0 compilation @ Linux
## COMPILATION OPTIONS ##
--with-libdir=/lib/x86_64-linux-gnu --with-curl --with-gd --enable-exif --enable-gd-native-ttf --with-freetype-dir=/usr/lib/x86_64-linux-gnu --with-ttf --with-gettext --with-jpeg-dir=/usr/include --with-libpng --with-openssl --with-mcrypt --with-mhash --with-mysql=/usr --with-mysqli --with-pdo-mysql --with-pdo-pgsql --with-pear --with-zlib --enable-zip --with-bz2 --with-iconv --enable-bcmath --enable-calendar --enable-ftp --with-gmp --enable-sockets --enable-intl --enable-mbstring --with-mcrypt=/usr --with-litespeed --enable-opcache
## PACKAGES ##
build-essential autoconf libxml2 libxml2-dev openssl libssl-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libfreetype6 libfreetype6-dev libmcrypt-dev libmhash-dev libmysql++-dev libgmp-dev libicu-* bzip2 libbz2-dev libpq-dev
## HACKS ##
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
@kiler129
kiler129 / CheckSwotDomains.php
Last active June 24, 2020 03:31
This tool can be used to verify domains in Swot project (https://github.com/leereilly/swot) by checking A/AAAA and MX records for them. It's horribly written in 10 minutes, but works ;)
<?php
define('DOMAINS_DIRECTORY', 'lib/domains/');
function path2Domain($path, $prefix = DOMAINS_DIRECTORY)
{
$prefixPos = strpos($path, $prefix);
if ($prefixPos !== 0) {
throw new InvalidArgumentException('Path does not begin with given prefix');
}
#!/usr/bin/php
<?php
if(!isset($argv[1])) die("No prefix!\n");
define('DRY_RUN', (!isset($argv[2]) || $argv[2] !== '-r'));
define('F_PREFIX', (empty($argv[1])) ? '' : ($argv[1] . '.'));
if(DRY_RUN) echo "-- DRY RUN --\n\n";
$fi = new FilesystemIterator('./');
$ri = new RegexIterator($fi, '/(?:(?:(\d?\d)x(\d\d))|(?:s(\d\d)e(\d\d))).*?\.([a-z]{3,4})$/i', RegexIterator::GET_MATCH);
PHP Compilation x64
——————————
+++++++++++++++++++++++++
+ 7.3.7 @ Debian/Ubuntu +
+++++++++++++++++++++++++
./configure \
--prefix=/usr/local/lsws/lsphp73 \
--enable-cli \
--disable-cgi \
diff -Naur libevent-master/http.c libevent-master-mod2/http.c
--- libevent-master/http.c 2016-11-18 11:58:08.000000000 -0600
+++ libevent-master-mod2/http.c 2016-11-27 01:30:06.726038913 -0600
@@ -192,13 +192,14 @@
static void evhttp_write_buffer(struct evhttp_connection *,
void (*)(struct evhttp_connection *, void *), void *);
static void evhttp_make_header(struct evhttp_connection *, struct evhttp_request *);
+static int evhttp_method_may_have_body_(struct evhttp_connection *, enum evhttp_cmd_type);
/* callbacks for bufferevent */
@kiler129
kiler129 / RATZEROTHE.B
Created October 21, 2018 05:24
Rational Zero Theorem implementation in TI-Basic
Define rzt(l,c)=
Prgm
: If l=0 Then
: Disp "ERR:l=0"
: Stop
: EndIf
: If c=0 Then
: Disp "ERR:c=0"
: Stop
: EndIf
@kiler129
kiler129 / composer.json
Created July 19, 2020 21:03
PHP Code Quality
{
"type": "project",
"license": "MIT",
"minimum-stability": "dev",
"prefer-stable" : true,
"require": {
"php-64bit": "^7.4.0"
},
"require-dev": {
"object-calisthenics/phpcs-calisthenics-rules": "^3.7",