Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing on playing ;)

Kamrul Ahsan k4mrul

🎯
Focusing on playing ;)
Block or report user

Report or block k4mrul

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
@azizultex
azizultex / Piklist Widget with Group Fields
Last active Feb 7, 2019
Piklist Widget with Group Fields
View Piklist Widget with Group Fields
<?php
piklist('field', array(
'type' => 'text'
,'field' => 'title'
,'label' => 'Title'
));
piklist('field', array(
'type' => 'group'
View adblock.sh
#!/bin/sh
#Put in /etc/adblock.sh
#Script to grab and sort a list of adservers and malware
#Check proper DHCP config and, if necessary, update it
uci get dhcp.@dnsmasq[0].addnhosts > /dev/null 2>&1 || uci add_list dhcp.@dnsmasq[0].addnhosts=/etc/block.hosts && uci commit
#Leave crontab alone, or add to it
grep -q "/etc/adblock.sh" /etc/crontabs/root || echo "0 4 * * 0,3 sh /etc/adblock.sh" >> /etc/crontabs/root
@lukecav
lukecav / functions.php
Last active Oct 2, 2019 — forked from eteubert/wordpress-passwort-reset-unmultisite.php
WordPress Multisite: Password Reset on a Subsite.
View functions.php
/**
* Password reset on sub site (1 of 4)
* Replace login page "Lost Password?" urls.
*
* @param string $lostpassword_url The URL for retrieving a lost password.
* @param string $redirect The path to redirect to.
*
* @return string
*
* @since 1.0.0
View Listen on UDP using netcat
# create an UDP server using nc on port 11090
nc -ul 11090
# check whether an UDP server is listening on 11190
nc -vz -u <hostname> 11090
# send a packet to the UDP server
echo -n "hello" | nc -4u -w1 <hostname> 1118
@cuth
cuth / debug-scroll.md
Last active Dec 24, 2019
Find the elements that are causing a horizontal scroll. Based on http://css-tricks.com/findingfixing-unintended-body-overflow/
View debug-scroll.md

Debug Horizontal Scroll

(function (d) {
    var w = d.documentElement.offsetWidth,
        t = d.createTreeWalker(d.body, NodeFilter.SHOW_ELEMENT),
        b;
    while (t.nextNode()) {
        b = t.currentNode.getBoundingClientRect();
        if (b.right > w || b.left < 0) {
@stephenharris
stephenharris / copy-pre.css
Last active Dec 30, 2019
Adding a 'copy' button to <pre> content
View copy-pre.css
.pre-wrapper{
position:relative;
}
.pre-wrapper pre{
padding-top: 25px;
}
.pre-wrapper .copy-snippet {
border-radius: 0;
min-width:55px;
background: none repeat scroll 0 0 transparent;
@akosveres
akosveres / mariadb.yml
Last active Jan 16, 2020
Mariadb + phpmyadmin docker-compose
View mariadb.yml
version: "2"
services:
db:
image: mariadb
environment:
- MYSQL_ROOT_PASSWORD=test
- MYSQL_DATABASE=radio
volumes:
- ./database:/var/lib/mysql
phpmyadmin:
@glof2
glof2 / spacepaper.pyw
Last active Feb 7, 2020
Sets your wallpaper to NASA's picture of the day
View spacepaper.pyw
import requests
from bs4 import BeautifulSoup
from os import path, getcwd
import ctypes
import time
def windowswallpaper(image):
SPI_SETDESKWALLPAPER = 20
ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, image, 0)
@lrhache
lrhache / python-selenium-open-tab.md
Last active Feb 23, 2020
Python Selenium - Open new tab / focus tab / close tab
View python-selenium-open-tab.md

On a recent project, I ran into an issue with Python Selenium webdriver. There's no easy way to open a new tab, grab whatever you need and return to original window opener.

Here's a couple people who ran into the same complication:

So, after many minutes (read about an hour) of searching, I decided to do find a quick solution to this problem.

@huraji
huraji / php.ini
Last active Mar 11, 2020
Optimal php.ini configuration for Wordpress, see also https://xilab.co/what-are-the-best-wordpress-php-ini-settings/
View php.ini
# Wordpress php.ini configuration
upload_max_filesize = 32M
post_max_size = 32M
memory_limit = 128M
max_execution_time = 60
max_input_vars = 10000
max_input_time = 30
You can’t perform that action at this time.