Skip to content

Instantly share code, notes, and snippets.

@ScottPhillips
ScottPhillips / remote-image-cache.php
Created July 7, 2012 07:16
Cache remote image using PHP
<?php
function cache_image($image_url){
//replace with your cache directory
$image_path = 'path/to/cache/dir/';
//get the name of the file
$exploded_image_url = explode("/",$image_url);
$image_filename = end($exploded_image_url);
$exploded_image_filename = explode(".",$image_filename);
$extension = end($exploded_image_filename);
//make sure its an image
@Belphemur
Belphemur / build_nginx.sh
Last active November 13, 2022 13:05 — forked from MattWilcox/build_nginx.sh
Compiling Nginx with LibreSSL (and http2)
#!/usr/bin/env bash
# names of latest versions of each package
export NGINX_VERSION=1.15.5
export VERSION_NGINX=nginx-$NGINX_VERSION
export VERSION_LIBRESSL=libressl-2.8.1
export VERSION_PCRE=pcre-8.42
#export NPS_VERSION=1.9.32.10
#export VERSION_PAGESPEED=v${NPS_VERSION}-beta
@e7d
e7d / README.md
Last active December 19, 2022 09:13
[Debian] Build a Squid anonymous proxy from source code

If you don't want to build Squid from scratch, you can simply Setup a Squid anonymous proxy

Build a Squid anonymous proxy from source code

Please note that this whole manual refers to the version 3.5.23 of Squid. You probably would have to adapt some commands to the version you will actually download.

Table of contents

@wudi
wudi / cls_template.php
Created January 28, 2015 15:24
ECshop preg_replace /e 修饰符修复(本文件可直接替换2.7.3)
<?php
/**
* ECSHOP 模版类
* ============================================================================
* * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。
* 网站地址: http://www.ecshop.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
class RedisSessionStore(SessionStore):
def __init__(self, expire = 1800, key_prefix=''):
SessionStore.__init__(self)
self.redis = redis.Redis(tools.config.get('redis_host', 'localhost'),
int(tools.config.get('redis_port', 6379)),
int(tools.config.get('redis_dbindex', 1)),
password=tools.config.get('redis_pass', None))
self.path = session_path()
self.expire = expire
self.key_prefix = key_prefix
@DavideMontersino
DavideMontersino / private-fork.md
Last active February 27, 2024 12:56
How to fork to a private gitlab instance

Theory:

your git repository can have more than one remote server; In this case we want to have two:

  1. one for our private repository on gitlab (will be the default one, called origin)
  2. one to be connected to the source repo on github, to be able to pull new changes (will be called upstream)

How to make a private fork from github to gitlab

@lokhman
lokhman / ubuntu-hardening.md
Last active October 28, 2024 23:57
List of things for hardening Ubuntu

WARNING

May contain out of date information. Check the comments below!

The list of actions listed below was taken mostly from Book Of Zeus with minor modifications and did the job well for Ubuntu version, which was available at that moment (May 2016). This gist was created for internal use and was never meant to be discovered by the web, although Google managed to find and index this page, which was a great surprise for me. Please check the original source for the updated information (links are provided in most of the sections), and read the comments below: they provide more details about the usage experience.

System Updates

http://bookofzeus.com/harden-ubuntu/initial-setup/system-updates/

Keeping the system updated is vital before starting anything on your system. This will prevent people to use known vulnerabilities to enter in your system.

anonymous
anonymous / debug.php
Created July 9, 2016 09:34
ecshop debug mode
/*
DEBUG_MODE 有4种模式:
0 disabled debug
1 output error message
2 disabled caching
4 showing debug page
8 logging SQL query
在data/config.php 中加入
*/
@ageis
ageis / systemd_service_hardening.md
Last active November 15, 2024 09:28
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
anonymous
anonymous / add_eventon_el
Created February 27, 2018 03:07
[add_eventon_el cal_id="10" el_title="UPCOMING PERFORMANCES - 2016" pec="ft" number_of_months="4" fixed_year="2016" show_year="yes"]
[add_eventon_el cal_id="9" el_title="UPCOMING PERFORMANCES - 2017" pec="ft" fixed_date="01" fixed_month="01" fixed_year="2017" number_of_months="12" event_count="90" event_order="ASC"]
[add_eventon_el cal_id="8" el_title="Past Performances - 2016" pec="ft" fixed_date="01" fixed_month="01" fixed_year="2016" number_of_months="8" event_count="90" event_order="DESC"]
[add_eventon_el cal_id="7" el_title="Past Performances - 2015" pec="ft" fixed_date="01" fixed_month="01" fixed_year="2015" number_of_months="12" event_count="90" event_order="DESC" ]
[add_eventon_el cal_id="6" el_title="Past Performances - 2014" pec="ft" fixed_date="01" fixed_month="01" fixed_year="2014" number_of_months="12" event_count="80" event_order="DESC" ]
[add_eventon_el cal_id="5" el_title="Past Performances - 2013" pec="ft" fixed_date="01" fixed_month="01" fixed_year="2013" number_of_months="12" event_count="7