Skip to content

Instantly share code, notes, and snippets.

View socketz's full-sized avatar
📵
I may be slow to respond.

socketz socketz

📵
I may be slow to respond.
View GitHub Profile
@socketz
socketz / css3_separator.css
Last active August 29, 2015 14:02
CSS3 Separator
.separator1 {
border-bottom: 1px solid rgba(255, 255, 255, 0.9);
border-radius: 100% 100% 100% 100%;
border-top: 1px solid rgba(150, 150, 150, 0.9);
box-shadow: 0 2px 10px 0 #444, 0 4px 5px 0 #ccc;
display: block;
height: 0;
margin-bottom: 20px;
margin-top: 15px;
width: 100%;
@socketz
socketz / scrollbar_width.js
Created June 21, 2014 00:36
Get the scrollBar browser width tested on jQuery 1.8.3 IE7/8/9 Compatible
//Use this code to know the browser scrollbar width, for better calculation that you'll need in some cases
//jQuery dependency
function scrollbarWidth() {
var div = $('<div class="divSize1" style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div class="divSize2" style="height:100px;"></div>');
$('body').append(div);
div.css('overflow-y', 'scroll');
res = $('.divSize1').outerWidth() - $('.divSize2').outerWidth();
$(div).remove();
return res;
@socketz
socketz / factory_pattern_example.php
Last active August 29, 2015 14:05
Factory Pattern: Example of class inheritance, using a Factory constructor for components
/*
This is a snippet of code, using a Factory class constructor with modules of apps,
it's a simple but effective architecture, the differents apps can use other patterns internally
*/
<?php
class AppComponent {
private $myVar;
public function __construct(){
@socketz
socketz / post-update
Created January 25, 2016 12:14
post-update file for git push deployment
#!/bin/sh
#
# This hook does two things:
#
# 1. update the "info" files that allow the list of references to be
# queries over dumb transports such as http
#
# 2. if this repository looks like it is a non-bare repository, and
# the checked-out branch is pushed to, then update the working copy.
# This makes "push" function somewhat similarly to darcs and bzr.
@socketz
socketz / pip-full-update.sh
Created February 24, 2017 20:20
pip update all packages
#!/bin/env bash
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
@socketz
socketz / 0_nginx_example_config.md
Last active August 8, 2018 02:57
Prestashop 1.6.x + Nginx 1.13.x + PHP-FPM 7.0 + SSL Let's Encrypt Configuration Example

Prestashop 1.6.x + Nginx 1.13.x + PHP-FPM 7.0 + SSL Let's Encrypt

Place the files on next paths or other and replace in the files below:

  • /data/nginx/config/global/acme-challenge.conf
  • /data/nginx/config/global/restrictions.conf
  • /data/nginx/config/global/expires.conf
  • /data/nginx/config/snippets/ssl-params.conf
  • /data/nginx/config/conf.d/example.com.conf
@socketz
socketz / ipv4info.user.js
Last active December 30, 2018 07:24
IPv4info Export Tables to CSV
// ==UserScript==
// @namespace https://openuserjs.org/user/socketz
// @name ipv4info.user.js
// @description This script export ipv4info tables to CSV
// @copyright 2017, socketz (socketz.net)
// @license MIT; https://opensource.org/licenses/MIT
// @version 1.0.1
// @match *://ipv4info.com/*
// @match *://*.ipv4info.com/*
// @exclude http://ipv4info.com/tools/*
@socketz
socketz / 0_webproxy.sh
Last active February 3, 2018 11:09
Iodine + Webproxy + Google Chrome Configuration Bash Scripts (Tested on Ubuntu 16.04 x64)
#!/bin/bash
##
## IODINE + WEBPROXY CLIENT SNIPPET
## by @socketz
##
## Put your values
SSH_IP="1.2.3.4"
SSH_USER="user"
@socketz
socketz / mailcatcher
Last active January 12, 2019 12:02
Service configuration for Mailcatcher Daemon (https://github.com/sj26/mailcatcher) on systemd and init.d path. Put files in /etc/systemd/system/mailcatcher.service and /etc/init.d/mailcatcher. If you choose the mailcatcher.conf option, do not need other files, put this file in /etc/init/mailcatcher.conf.
#!/bin/sh
# Start/stop the mailcatcher daemon.
#
### BEGIN INIT INFO
# Provides: mailcatcher
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Should-Start: $local_fs $remote_fs $network $syslog $named
# Should-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
@socketz
socketz / connect.sh
Last active June 12, 2019 19:42
Comfortable script for connecting to HackTheBox OpenVPN (alternative to GUI tools)
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"