Skip to content

Instantly share code, notes, and snippets.

@djaiss
djaiss / gist:2938259
Created June 15, 2012 19:13
PHP List of countries
<?php
$countries =
array(
"AF" => "Afghanistan",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active May 7, 2024 18:55
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
@tott
tott / ip_in_range.php
Created November 27, 2013 22:46
php check if IP is in given network range
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
@danharper
danharper / background.js
Last active March 30, 2024 18:25
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@mildmojo
mildmojo / rotate_desktop.sh
Created June 18, 2014 06:47
Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops.
#!/bin/bash
#
# rotate_desktop.sh
#
# Rotates modern Linux desktop screen and input devices to match. Handy for
# convertible notebooks. Call this script from panel launchers, keyboard
# shortcuts, or touch gesture bindings (xSwipe, touchegg, etc.).
#
# Using transformation matrix bits taken from:
# https://wiki.ubuntu.com/X/InputCoordinateTransformation

Debian Kernel Hooks

Recently I setup my work laptop to dual boot Arch Linux and Ubuntu server with syslinux as my bootloader. I setup the laptop with a dedicated /boot partition that would be shared between the two operating systems. I added this boot entry to /boot/syslinux/syslinux.cfg.

LABEL ubuntu
    MENU LABEL Ubuntu 
    LINUX ../vmlinuz-3.8.0-29-generic
    APPEND root=LABEL=UBUNTU rw

INITRD ../initrd.img-3.8.0-29-generic

@jasemagee
jasemagee / fortune-rnd-cowsay-lolcat.sh
Created May 30, 2015 09:42
Fortune with random cowsay character and lolcat
fortune | cowsay -f "$(ls /usr/share/cowsay/cows | sort -R | head -1)" | lolcat
@exabrial
exabrial / FreeRadius, PEAP-MSCHAP, Samba, Ubuntu 14.04, ActiveDirectory, LDAP.md
Last active January 10, 2022 01:08
FreeRadius, PEAP-MSCHAP, Samba, Ubuntu 14.04, ActiveDirectory, LDAP

FreeRadius, PEAP-MSCHAP, Samba, Ubuntu 14.04, ActiveDirectory, LDAP

Why This guide

@groundrace
groundrace / webcryptoapi.html
Created April 13, 2016 23:56 — forked from deiu/webcryptoapi.html
Web Crypto API: RSA keygen & export & import & sign & verify & encrypt & decrypt
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
})
@bluebat
bluebat / menu.ipxe
Created October 20, 2016 07:55
Menu script for iPXE
#!ipxe
menu Selection
item liveins-freedos-1.0 FreeDOS 1.0 (ro)
item livesys-fdos-1.1 FDOS 1.1 (ro)
item liveiso-slitaz-current Slitaz current (ro)
item liveiso-tinycore-7.2 TinyCore 7.2 (ro)
item netsys-fedora-23 Fedora 23 (rw)
item netsys-korora-24 Korora 24 (rw)
choose os && goto ${os}