Skip to content

Instantly share code, notes, and snippets.

import re
import csv
import sys
import requests
from requests.exceptions import RequestException
import threading
from subprocess import call
from bs4 import BeautifulSoup
from html.parser import HTMLParseError
from urllib.parse import urljoin
@steelywing
steelywing / service.py
Created August 6, 2014 01:40
python windows service
import win32serviceutil
import win32service
import win32event
import servicemanager
# import signal
# import os
from multiprocessing import Process
from main import app
@steelywing
steelywing / linux.md
Last active October 22, 2017 08:03
linux

Network

Obsolete command

  • ifconfig => ip addr and ip link
  • netstat => ss, ip route

Set interface up on boot

/etc/sysconfig/network

NETWORKING=yes
@steelywing
steelywing / Mcrypt.php
Last active August 29, 2015 14:07
php mcrypt class
<?php
class Mcrypt
{
/**
* @var string Encryption key
*/
public $key;
@steelywing
steelywing / gpsd.md
Last active August 29, 2015 14:07
gpsd build build from source (CentOS 6.5)

Install

  • Download and extract
  • Refer INSTALL and build.txt in gpsd source
  • yum install gcc
  • yum install ncurses ncurses-devel
  • yum install python-devel
  • Install scons
  • Run scons in gpsd source folder
  • Run scons check
  • Run scons install
@steelywing
steelywing / ldap_escape.php
Last active September 4, 2023 08:07
ldap_escape() for PHP < 5.6
// Source: https://stackoverflow.com/a/8561604/1877620
if (!function_exists('ldap_escape')) {
define('LDAP_ESCAPE_FILTER', 0x01);
define('LDAP_ESCAPE_DN', 0x02);
/**
* @param string $subject The subject string
* @param string $ignore Set of characters to leave untouched
* @param int $flags Any combination of LDAP_ESCAPE_* flags to indicate the
@steelywing
steelywing / putty-serial.nsi
Last active August 29, 2015 14:27
Auto detect serial port to execute putty
# Wrap putty-serial.vbs to exe
Name "PuTTY Serial"
Icon "putty.ico"
OutFile "putty-serial.exe"
InstallDir "$TEMP"
RequestExecutionLevel user
SilentInstall silent
Section
@steelywing
steelywing / hosts.bat
Last active October 28, 2015 14:27
add host entry to windows hosts, run as administrator
@echo off
set hosts_file=%WINDIR%\System32\drivers\etc\hosts
set host=127.0.0.1 fvc_stat.freemake.com
find /i "%host%" %hosts_file% > nul
if %ERRORLEVEL% == 0 (
echo "%host%" already exist.
) else (
(echo. & echo %host%) >> %hosts_file%
//--VAR
$puts(brd,28-28-28)
$puts(brd2,70-70-70)
$puts(brd_g1,50-50-50)
$puts(brd_g2,35-35-35)
$puts(transparent, 0-0-0-0)
// Column padding
$puts(padding, 16)