Skip to content

Instantly share code, notes, and snippets.

View miketrebilcock's full-sized avatar

Mike Trebilcock miketrebilcock

View GitHub Profile
@pklaus
pklaus / enumerate_interfaces.py
Last active March 15, 2024 15:32
Python: List all Network Interfaces On Computer
"""
Determine IPv4 addresses on a Linux machine via the socket interface.
Thanks @bubthegreat the changes to make it Py2/3 compatible and the helpful
code comments: https://gist.github.com/pklaus/289646#gistcomment-2396272
This version has all comments removed for brevity.
"""
import socket
import array
import struct
@joshilewis
joshilewis / MyClass.cs
Created February 5, 2012 14:00
Simple Unit of Work implementation
using System;
namespace ClassLibrary
{
public interface IDependency
{
void SomeMethod(string s);
}
public class MyClass
@hinnerk-a
hinnerk-a / wp_log_http_requests.php
Created May 31, 2012 20:31
WordPress filter hook for logging WP HTTP requests
<?php
function wp_log_http_requests( $response, $args, $url ) {
// set your log file location here
$logfile = plugin_dir_path( __FILE__ ) . '/http_requests.log';
// parse request and response body to a hash for human readable log output
$log_response = $response;
if ( isset( $args['body'] ) ) {
@wafflesnatcha
wafflesnatcha / goo.gl.sh
Last active March 13, 2018 04:49
Bash: goo.gl # Shorten a URL using the Google URL Shortener service (http://goo.gl).
#!/usr/bin/env bash
# Usage: goo.gl [URL]
#
# Shorten a URL using the Google URL Shortener service (http://goo.gl).
goo.gl() {
[[ ! $1 ]] && { echo -e "Usage: goo.gl [URL]\n\nShorten a URL using the Google URL Shortener service (http://goo.gl)."; return; }
curl -qsSL -m10 --connect-timeout 10 \
'https://www.googleapis.com/urlshortener/v1/url' \
-H 'Content-Type: application/json' \
-d '{"longUrl":"'${1//\"/\\\"}'"}' |
@sararob
sararob / data-structure.js
Last active April 26, 2022 22:21
Role-based security in Firebase
/*
This example shows how you can use your data structure as a basis for
your Firebase security rules to implement role-based security. We store
each user by their Twitter uid, and use the following simplistic approach
for user roles:
0 - GUEST
10 - USER
20 - MODERATOR
@snowyu
snowyu / ts-quasar-cli.md
Created September 8, 2018 13:19
Add the typescript supports to quasar framework

Note: This guide applies to the project created by quasar-cli.

First install typescript and ts-loaderpackages in your project.

npm i -D typescript ts-loader

Then modified the quasar.conf.js file in your project:

@Hakky54
Hakky54 / openssl_commands.md
Last active April 19, 2024 10:58 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

OpenSSL 🔐

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl