Skip to content

Instantly share code, notes, and snippets.

View antonydevanchi's full-sized avatar
💭
I may be slow to respond.

Anton Piskunov antonydevanchi

💭
I may be slow to respond.
View GitHub Profile
@blasterpal
blasterpal / test_email.rb
Created November 17, 2010 15:36
Plain SMTP Email-Relay Test script
require 'net/smtp'
message = <<MESSAGE_END
From: Hank Beaver <hbeaver@maxmedia.com>
To: Hank Beaver <hbeaver@gmail.com>
Subject: SMTP e-mail test
This is a test e-mail message.
MESSAGE_END
@dzuelke
dzuelke / bcrypt.php
Last active March 28, 2023 13:15
How to use bcrypt in PHP to safely store passwords (PHP 5.3+ only)
<?php
// secure hashing of passwords using bcrypt, needs PHP 5.3+
// see http://codahale.com/how-to-safely-store-a-password/
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt
$salt = substr(strtr(base64_encode(openssl_random_pseudo_bytes(22)), '+', '.'), 0, 22);
// 2y is the bcrypt algorithm selector, see http://php.net/crypt
// 12 is the workload factor (around 300ms on my Core i7 machine), see http://php.net/crypt
@senko
senko / onchange.sh
Last active July 14, 2023 07:54
OnChange - Watch current directory and execute a command if anything in it changes
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@nysean79
nysean79 / relaytest.sh
Created January 19, 2012 14:36
SMTP relay test script
#!/usr/bin/env bash
## Version 1.0.2
my_email_body="Test from telnet"
mail_server_ip="127.0.0.1"
mail_server_port="25"
recipient="sryan@example.com"
sender="\"Ubuntu Server\"<ubuntu@example.com>"
nc ${mail_server_ip} ${mail_server_port} << EOF
@lukeman
lukeman / gist:2155355
Created March 22, 2012 03:06
Apple Domains
#! /usr/bin/perl
# version 1.1
# if the host+path are in matrix then the redirect is to a single location
# if just the host is in matrix then the redirect is to host+the request uri
# nwk-productred 17.149.160.28&nbsp&amp&nbsp17.172.224.28
#
# to distibute this file us /usr/local/scr/distfilex
#
#
@njh
njh / _README.md
Last active October 5, 2019 12:06
Shell script to create a WebID certificate using OpenSSL
@raphaelstolt
raphaelstolt / php54_php53_pear_macports.markdown
Created May 17, 2012 21:37
Installing PHP 5.4 and 5.3 side by side on Max OSX via MacPorts

##Given Apache 2 and MySQL are already installed.

#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated

#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules

@jbarber
jbarber / LdapAuth.java
Created June 11, 2012 12:20
LDAP example for searching and simple binding (authentication)
/*
* First create the keystore (to allow SSL protection) by importing the LDAP
* certificate (cert.pem) with:
* keytool -import -keystore keystore -storepass changeit -noprompt -file cert.pem
*
* You can get the certificate with OpenSSL:
* openssl s_client -connect ldap.server.com:636 </dev/null 2>/dev/null | sed -n '/^-----BEGIN/,/^-----END/ { p }' > cert.pem
*
* Then compile this class with:
* javac LdapAuth.java
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active July 22, 2024 12:48
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active July 4, 2024 17:31
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1