Skip to content

Instantly share code, notes, and snippets.

View kundancool's full-sized avatar
💭
I may be slow to respond.

Kundan kundancool

💭
I may be slow to respond.
View GitHub Profile
@kundancool
kundancool / LICENSE.txt
Created September 30, 2011 08:37 — forked from p01/LICENSE.txt
Sudoku Solver in 140bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri <http://www.p01.org/releases/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@kundancool
kundancool / Adaway.sh
Last active November 15, 2023 00:48
AdAway for Linux
#!/bin/sh
#==================================================
# AdAway implementation in shell
#==================================================
#
TMP_WORK_PATH="/tmp/.AdAway"
count=0
host_sources="https://hosts-file.net/ad_servers.txt
https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext
@kundancool
kundancool / get_wck_select_by_slug.php
Created December 2, 2016 11:38
Get WCK select options by slug
<?php
function get_wck_select_by_slug($slug) {
global $wpdb;
$results = $wpdb->get_results( "select * from $wpdb->postmeta where meta_value = '".$slug."'", ARRAY_A );
$post_id = $results[0]['post_id'];
$separator = explode('_', $results[0]['meta_key']);
$suffix = isset($separator[1]) ? '_'.$separator[1] : '';
$options = explode(',', get_post_meta($post_id, 'options'.$suffix, true));
$labels = explode(',', get_post_meta($post_id, 'labels'.$suffix, true));
/* initialize var */
@kundancool
kundancool / jenkins-git-backup.sh
Created January 13, 2017 10:06 — forked from choldrim/jenkins-git-backup.sh
Example of a script for backing up Jenkins config in git.
#!/bin/bash
# Copies certain kinds of known files and directories from a given Jenkins master directory
# into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em.
set -ex
if [ $# -ne 3 ]; then
echo usage: $0 jenkins_home git_repos_url git_repos_name
exit 1
fi
@kundancool
kundancool / dawnwing-co-za-api.php
Created August 21, 2017 13:34
[PHP] dawnwing.co.za Tracking scrapper
<?php
/**
* Tracking package via cURL from www.dawnwing.co.za
*
* @author Kundan K Singh <kundandeveloper@gmail.com>
*/
define('DOMAIN_REQUEST_URL', 'http://www.dawnwing.co.za/business-tools/online-parcel-tracking/');
include_once 'simple_html_dom.php';
@kundancool
kundancool / length-aware-paginator.php
Created May 10, 2018 08:33
Laravel Length Aware Pagination for custom array
<?php
public function sampleArrayPaginator(Request $request) {
$response = array();
$page = ($request->has('page')) ? intval($request->page) : 1;
$size = ($request->has('size')) ? intval($request->size) : 10;
$collection = collect($response);
$total = $collection->count();
return new LengthAwarePaginator(
array_values($collection->forPage($page, $size)->toArray()),
$collection->count(),
@kundancool
kundancool / GoogleSheetController.php
Last active April 6, 2019 16:45
Google Sheet Controller for Laravel
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class GoogleSheetController extends Controller
{
protected $sheets;
{
"shell_cmd": "php-cs-fixer fix --rules=@Symfony,array_indentation --using-cache=false $file",
"file_regex": "php$"
}
@kundancool
kundancool / darken.js
Last active November 7, 2020 13:24
darken.js
javascript: (function() {
var newSS, styles = '* { background: #282b2e ! important; color: #e0e2e4 !important } :link, :link * { color: #2868C7 !important } :visited, :visited * { color: #dddddd !important }';
if (document.createStyleSheet) {
document.createStyleSheet("javascript:'" + styles + "'");
} else {
newSS = document.createElement('link');
newSS.rel = 'stylesheet';
newSS.href = 'data:text/css,' + escape(styles);
document.getElementsByTagName("head")[0].appendChild(newSS);
}
@kundancool
kundancool / Dockerfile
Created November 13, 2021 13:44
laravel-php7.4-fpm-alpine
# Base Image
FROM php:7.4-fpm-alpine
# Update system packages
RUN apk update && apk upgrade
# Install required pacjages
RUN apk add --no-cache nano vim nginx composer supervisor npm git htop \
bzip2-dev zlib-dev libpng icu-dev libxml2-dev \
freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev gettext-dev \