This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will change the hostname of a Mac to a dot-separated version | |
# of the full name of the most-commonly-logged-in user with a local home. | |
# Give a list of usernames to ignore, separated by spaces | |
ignore_list=( root admin administrator bukowinskip ) | |
# Get a list of usernames sorted by login frequency, limited to the last 100 logins | |
login_list=$(last -t console -100 | \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To disable Safari’s annoying modal local database | |
# storage dialog, use this Terminal command: | |
defaults write com.apple.Safari WebKitDatabasesEnabledPreferenceKey -bool false | |
# To disable local storage altogether, use this command: | |
defaults write com.apple.Safari WebKitLocalStorageEnabledPreferenceKey -bool false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <NewtonGestalt.h> | |
#include <NewtonScript.h> | |
#include <BufferList.h> | |
#include <BufferSegment.h> | |
class TGPIOInterface | |
{ | |
public: | |
NewtonErr ReadGPIOData (UByte, ULong *); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Progressify</title> | |
<script> | |
var Plot = (function() { | |
function Point(duration, progress) { | |
this.duration = duration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <limits.h> | |
#include <stdlib.h> | |
int main (int argc, char *argv[]) { | |
char* instr; | |
char outstr[PATH_MAX]; | |
instr = argv[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ldapuser = 'user'; | |
$ldappass = 'pass'; | |
// Required groups | |
$groups = array('cn=group1', 'cn=group2'); | |
// Ldap stuff | |
$directory = 'directory.example.dk'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is the simplest and cleanest way I've come up with for securely compressing (gzip, in this example) & encrypting data to disk with OpenSSL from a bash script without exposing the password to inspection of process or environment variable using `ps` and the likes. Naturally, `cat` is just used as an example so the data can come from anywhere. If the compressed data is to be sent via email instead of written to disk, don't use '-out' and use '-a' to base64 encode the compressed data. | |
# | |
# References: | |
# http://www.madboa.com/geek/openssl/#encrypt-simple | |
# http://unix.stackexchange.com/questions/29111/safe-way-to-pass-password-for-1-programs-in-bash#answer-29186 | |
# http://stackoverflow.com/questions/6607675/shell-script-password-security-of-command-line-parameters/6607773#6607773 | |
# https://gist.github.com/philfreo/2321650 | |
cat "$file" | gzip -c | openssl enc -e -salt -aes-256-cbc -pass fd:3 -out "$file.gz.enc" 3<<<"$password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Mail" | |
set _sel to get selection | |
if (count of _sel) > 1 then | |
-- multiple message selection, usually a conversation thread | |
choose from list {"Reply", "Reply All"} with prompt "Unknown recipient count." default items {"Reply"} | |
try | |
set _menu_command to item 1 of the result | |
on error | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aws-sdk' | |
class BucketSyncService | |
attr_reader :from_bucket, :to_bucket, :logger | |
attr_accessor :debug | |
DEFAULT_ACL = "public-read" | |
def initialize(from_bucket, to_bucket) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Based off of Gruber's awesome url regex: http://daringfireball.net/2010/07/improved_regex_for_matching_urls | |
In addition: | |
- Should match 'example.com', 'google.net', 'google.org'. (only com, net, and org are whitelisted). | |
- Should not match 'sam@samuelcole.name'. | |
*/ | |
var URL_RE = /(?:(?=[\s`!()\[\]{};:'".,<>?«»“”‘’])|\b)((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/|[a-z0-9.\-]+[.](?:com|org|net))(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))*(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]|\b))/gi |
OlderNewer