Skip to content

Instantly share code, notes, and snippets.

@kidesigner
kidesigner / redsocks.conf
Created July 12, 2024 09:12 — forked from afriza/redsocks.conf
Setup iptables for RedSocks in OpenWRT
base {
// debug: connection progress & client list on SIGUSR1
log_debug = on;
// info: start and end of client session
log_info = on;
/* possible `log' values are:
* stderr
* file:/path/to/file
@kidesigner
kidesigner / openwrt_squid.md
Created July 12, 2024 09:11 — forked from gmeeker/openwrt_squid.md
OpenWRT squid proxy with authentication

OpenWRT installation of HTTP proxy with authentication

Based on OpenWRT: 18.06.1

(Note: using tinyproxy might accomplish this with less work, but only 1.10 supports authentication. As of December 2018, OpenWRT does not include that version. However, squid also supports other authentication methods so this guide may remain useful.)

I wanted to turn an ordinary WiFi router into an HTTP proxy, but it turns out that the guides I found are for transparent proxies, and worse, OpenWRT doesn't compile authentication into squid!

Official OpenWRT guide to Squid (don't follow these steps blindly, as its only purpose is HTTP caching):

(() => {
var GetToken = (callback) => {
var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
var http = new XMLHttpRequest;
var data = new FormData();
data.append('fb_dtsg', fb_dtsg);
data.append('app_id','124024574287414');
data.append('redirect_uri', 'fbconnect://success');
data.append('display', 'popup');
data.append('ref', 'Default');
@kidesigner
kidesigner / gist:0b35c3a6c366b115150fc246c445d1e4
Created August 15, 2018 16:02 — forked from mhawksey/gist:1442370
Google Apps Script to read JSON and write to sheet
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}
@kidesigner
kidesigner / _baseline.scss
Created November 10, 2015 02:46 — forked from razwan/_baseline.scss
Aligning type to baseline the right way with SASS
$base-font-size: 16px;
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
@kidesigner
kidesigner / WordPress - Import Menu Item's custom fields.php
Created October 25, 2015 08:34 — forked from mo3aser/WordPress - Import Menu Item's custom fields.php
How to modify the WordPress importer plugin to Import Menu Item's custom fields
<?php
# WordPress - Import Menu Item's custom fields
# By Fouad Badawy - TieLabs.com
#1- Edit wordpress-importer.php
#2 search for
$id = wp_update_nav_menu_item( $menu_id, 0, $args );
if ( $id && ! is_wp_error( $id ) )
$this->processed_menu_items[intval($item['post_id'])] = (int) $id;
<?php /* This function attaches the image to the post in the database, add it to functions.php */
function insert_attachment($file_handler,$post_id,$setthumb='false') {
// check to make sure its a successful upload
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
require_once(ABSPATH . "wp-admin" . '/includes/media.php');
<?php
if ( !function_exists('your_pagination')) :
function your_pagination($custom_query) {
if ( !$current_page = get_query_var( 'paged' ) ) $current_page = 1;
$permalinks = get_option( 'permalink_structure' );
if( is_front_page() ) {
$format = empty( $permalinks ) ? '?paged=%#%' : 'page/%#%/';
} else {
<?php
/*
Plugin Name: Comment meta data test
Version: 1.0
Plugin URI: http://wpengineer.com
Description: Comment meta data test
Author: Latz
Author URI: http://wpengineer.com
*/