Skip to content

Instantly share code, notes, and snippets.

@koekaverna
koekaverna / KeepUTMRedirect.php
Last active February 18, 2020 13:22
Laravel middleware that keeps utm marks while redirect
<?php
// This middleware save utm query from url while redirect
// It's require Spatie\Url (https://github.com/spatie/url)
namespace App\Http\Middleware;
use Closure;
use Spatie\Url\Url;
class KeepUTMRedirect
@AALMA
AALMA / massInsertOrUpdate.php
Last active September 25, 2020 07:04 — forked from RuGa/massInsertOrUpdate.php
Mass (bulk) insert or update on duplicate for Laravel 4/5
<?php
namespace App\Traits;
use DB;
use Carbon\Carbon;
trait MassInsertOrUpdate
{
protected $insert_or_update_chunk_size = 1000;
@flyzjhz
flyzjhz / dog.sh
Created December 28, 2016 07:25 — forked from murilopontes/dog.sh
Openwrt watchdog script
#!/bin/sh
# save dog.sh in /root/dog.sh.
# You can use winscp with scp protocol to do this.
# Using ssh set executation permission and replace the crontab:
# chmod +x /root/dog.sh
# echo "* * * * * /root/dog.sh" | crontab -
# fix wpad / wpad-mini / hostapd stop working bug
logread -l 100 | grep -n "IEEE 802.11: did not acknowledge authentication response"
@sheharyarn
sheharyarn / request.js
Last active August 24, 2023 14:55
Axios Request Wrapper for React (https://to.shyr.io/axios-requests)
/**
* Axios Request Wrapper
* ---------------------
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
*/
import axios from 'axios'
@mcnamee
mcnamee / bitbucket-pipelines.yml
Last active December 14, 2023 03:57
Bitbucket Pipelines - Deploy via FTP to shared hosting
# Installation ---
# 1. In Bitbucket, add FTP_USERNAME, FTP_PASSWORD and FTP_HOST as environment variables.
# 2. Commit this file (bitbucket-pipelines.yml) to your repo (in the repo root dir)
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will
# push everything and initialize GitFTP)
#
# Usage ---
# - On each commit to master branch, it'll push all files to the $FTP_HOST
# - You also have the option to 'init' (see 'Installation' above) - pushes everything and initialises
# - Finally you can also 'deploy-all' (from Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:deploy-all)
@subfuzion
subfuzion / curl.md
Last active May 8, 2024 04:57
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@yang-wei
yang-wei / fullscreen.css
Last active February 6, 2023 23:50
Full size background image using CSS cover in mobile devices
html {
background: url(image url) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height: 100%;
overflow: hidden;
}
@teffalump
teffalump / README.md
Last active January 4, 2023 21:17
OpenWRT adblock implementation

Others have recently developed packages for this same functionality, and done it better than anything I could do. Use the packages instead of this script:

Description

In its basic usage, this script will modify the router such that blocked addresses are null routed and unreachable. Since the address blocklist is full of advertising, malware, and tracking servers, this setup is generally a good thing. In addition, the router will update the blocklist weekly. However, the blocking is leaky, so do not expect everything to be blocked.

@aarmot
aarmot / adblock
Last active September 7, 2016 18:04
Adblock skript for OpenWrt. Tested on Attitude Adjustment 12.09
#!/bin/sh /etc/rc.common
# Copy this skript to /etc/init.d/adblock and enable:
# chmod +x /etc/init.d/adblock
# /etc/init.d/adblock enable
START=90
ADS='http://pgl.yoyo.org/as/serverlist.php?hostformat=dnsmasq&showintro=0&mimetype=plaintext'
@HarishChaudhari
HarishChaudhari / country-code-to-currency-code-mapping.csv
Last active April 26, 2024 12:10
Country, Country Code, Currency code mapping in CSV format Taken from https://gist.github.com/304261 Contains 249 countries.
Country CountryCode Currency Code
New Zealand NZ New Zealand Dollars NZD
Cook Islands CK New Zealand Dollars NZD
Niue NU New Zealand Dollars NZD
Pitcairn PN New Zealand Dollars NZD
Tokelau TK New Zealand Dollars NZD
Australian AU Australian Dollars AUD
Christmas Island CX Australian Dollars AUD
Cocos (Keeling) Islands CC Australian Dollars AUD
Heard and Mc Donald Islands HM Australian Dollars AUD