Skip to content

Instantly share code, notes, and snippets.

💭
dasasdadshbjafksfgdakjsdfhgaks

Luckydonald luckydonald

💭
dasasdadshbjafksfgdakjsdfhgaks
Block or report user

Report or block luckydonald

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@luckydonald
luckydonald / gist:cfde4c8107da30390b17ddc35b964f4a
Created Jun 11, 2019 — forked from nerones/gist:6778719
An easy way to log session data and queries with Monolog and Hooks in codeigniter. Some of the code is taken from Profiler class in the core of CI. The hook must be post_controller or post_system
View gist:cfde4c8107da30390b17ddc35b964f4a
class LoggerHook
{
private $CI;
function __construct()
{
$this->CI =& get_instance();
}
public function log()
{
View part1.py
def num(n):
string = ["", "", ""]
for d in str(int(n)):
for i, l in enumerate(digit(int(d)).split("\n")):
string[i] += l
# end for
# end for
return "\n".join(string)
# end def
@luckydonald
luckydonald / function.cast.php
Created Jul 23, 2018 — forked from borzilleri/function.cast.php
PHP function to cast an object from one class to another.
View function.cast.php
<?php
/**
* Cast an object into a different class.
*
* Currently this only supports casting DOWN the inheritance chain,
* that is, an object may only be cast into a class if that class
* is a descendant of the object's current class.
*
* This is mostly to avoid potentially losing data by casting across
* incompatable classes.
View iOS_11_webapp_statusbar_issues__index.html
<html>
<head>
<title>Test</title>
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-title" content="something" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, height=device-height">
<style>
View diff.patch
[35%]tstrazzere@bebop:[rsakeyfind] $ diff rsakeyfind.cpp-fixed rsakeyfind/rsakeyfind.cpp-original
colordiff 1.0.10 (http://colordiff.sourceforge.net/)
(C)2002-2012 Dave Ewart, davee@sungate.co.uk
4,5d3
<
< #include <unistd.h>
8a7
> #include <fcntl.h>
View check_authorization.php
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@luckydonald
luckydonald / answer.md
Last active Feb 17, 2018
How to get the hostnames and informations of other hosts in the same docker scale grouping. http://stackoverflow.com/a/39895650/3423324
View answer.md

The way I could do it was by using the docker api. I used the docker-py package to access it.

The api exposes a labels dictionary for each container, and the keys com.docker.compose.container-number, com.docker.compose.project and com.docker.compose.service did what was needed to build the hostname.

The code below is a simplified for code I am now using. You can find my advanced code with caching and fancy stuff that at Github at luckydonald/pbft/dockerus.ServiceInfos (backup at gist.github.com).

@luckydonald
luckydonald / image_sizer.py
Last active Apr 2, 2018
A script to scale images to a monitor resulution and add the best fitting background color
View image_sizer.py
"""
Makes border aware sizing of desktop wallpapers.
You need to install:
$ pip install Pillow easygui joblib
"""
import glob
import os
View utf8_javascript_decode
https://jsfiddle.net/wfr4tLku/0/ # http://stackoverflow.com/a/36949791/3423324
http://jsfiddle.net/Z9pQE/44/ # http://stackoverflow.com/a/17192845/3423324
http://jsfiddle.net/3VuLx/244/ # http://stackoverflow.com/a/22373135/3423324
@luckydonald
luckydonald / Api urls.md
Last active Apr 20, 2016 — forked from anonymous/Api urls
json api of several pages I encountered.
View Api urls.md
You can’t perform that action at this time.