Skip to content

Instantly share code, notes, and snippets.

@lg
lg / angry_wifi.sh
Last active January 20, 2025 03:22
auto disconnects clients with a low signal strength on LEDE / OpenWRT
#!/bin/ash
#
# angry_wifi.sh
#
# auto disconnects clients with a low signal strength on LEDE / OpenWRT. great
# for clients who hold onto a lower-signal-strength accesspoint instead of
# roaming. before running, make sure to download the latest MAC addresses with:
#
# wget --no-check-certificate -O - 'https://services13.ieee.org/RST/standards-ra-web/rest/assignments/download/?registry=MAC&text=apple' | cut -d, -f2 > apple_mac_addresses
#
@dangtrinhnt
dangtrinhnt / ad_utils.py
Created July 28, 2016 02:03
Get Active Directory group members using python
#! /bin/env python
#
# USAGE
# $ python ad_utils.py "My Group Name"
#
# Author:
# Trinh Nguyen
# [email protected]
# www.dangtrinh.com
@meskarune
meskarune / ssh.yml
Created July 4, 2016 19:43
ansible playbook for setting up ssh
---
- hosts: new
vars:
- root_password: 'foo'
- minerva_password: 'bar'
tasks:
- name: Change root password
user:
name=root
@technoknol
technoknol / ip-range-CIDR-to-IP-list.php
Last active September 25, 2024 06:59
IP Range CIDR to ALL IP LIST
<?php
// IP Range CIDR to ALL IP LIST
// e.g. 220.78.168.0/21 to all IP list Range
$start_ip = '220.78.168.0';
$prefix = '28';
$ip_count = 1 << (32 - $prefix);
$start = ip2long($start_ip);
for ($i = 0; $i < $ip_count; $i++) {
echo $ip = long2ip($start + $i) . '<br />';
From terminal:
1: yum install epel*
2: yum update / yum upgrade
3: Add repo source
- CentOS and Red Hat Enterprise Linux 6.x
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm
@straight-shoota
straight-shoota / README.md
Created February 29, 2016 23:53
Unlink unused config files in sites-enabled with Ansible

This task cleans sites-enabled dir from config files that should not be enabled anymore Its quite easy to use a list of enabled sites to link their config files to sites-enabled, as shown in the last entry. There will still be links to the config files of sites that had been enabled in the previous ansible run, they need to be removed explicitly. The simple way would be to remove the sites-enablied directory alltogether. But this would allways require to create new links to the config files for enabled sites. Thus it would force a server restart even if there had really no changes at all. Defining a var disabled_sites is not quite a good idea since you would probably forget to add or remove items from that list at one time. So my solution is to list all config files that do not correspond to enabled sites and in a second step remove those.

I use it with nginx, but it should also work with apache/httpd or other configurations with a similar concept.

It would be easier to use just rm with an extended gl

@terbo
terbo / apls
Last active January 5, 2022 11:20
list wireless clients connected to hostapd access point
#!/usr/bin/python
#
# read /var/run/hostapd for interfaces to poll
# read process list to find list of running hostapds (or get from hostapd_cli)
# get mac address, connected time, transmitted packets
# read arp table
# match arp address to ip address
# print matches
# rinse repeat
@juliobitencourt
juliobitencourt / StaticController.php
Last active June 5, 2020 16:33
A Laravel controller to serve Static pages. It translates the slug to a view file, but you might override this behavior with yout own methods
<?php
namespace App\Http\Controllers\Web;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class StaticController extends Controller
@sabas1080
sabas1080 / ESP8266DHT11.ino
Created January 5, 2016 18:56
Midiendo temperatura con ESP8266 y DHT11
/* DHTServer - ESP8266 Webserver with a DHT sensor as an input
Based on ESP8266Webserver, DHTexample, and BlinkWithoutDelay (thank you)
Version 1.0 5/3/2014 Version 1.0 Mike Barela for Adafruit Industries
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <DHT.h>
@xgin
xgin / letsencrypt-hostname.sh
Created January 4, 2016 07:29
Secure plesk clean installation with hostname certificate by Let's Encrypt
#!/bin/bash -e
### Copyright 1999-2015. Parallels IP Holdings GmbH. All Rights Reserved.
### Secure plesk clean installation with hostname certificate by Let's Encrypt
export PYTHONWARNINGS="ignore:Non-standard path"
LE_HOME=${LE_HOME:-"/usr/local/psa/var/modules/letsencrypt"}
HOSTNAME=$(hostname)
# Use staging server for testing
# --server https://acme-staging.api.letsencrypt.org/directory