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_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 / 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 / getip.py
Created September 7, 2018 20:38
Python3 get interface IP address
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import socket
import fcntl
import struct
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
fdsock = s.fileno()
@socketz
socketz / base64_rotation.sh
Last active September 23, 2018 08:42
Bash Base64 encoding / decoding functions with rotation (rotXX / rot13)
#!/bin/bash
function rot_base64_e(){
USAGE="\nrot_base64_e <input_file_or_string> <rotation> [<output> empty for print]\nUsage example: rot_base64_e file.txt 13 output.txt\n"
if [ -f "$1" ]; then
CONTENT=$(cat $1)
elif [ -n "$1" ]; then
CONTENT=$1
else
@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/*