Skip to content

Instantly share code, notes, and snippets.

View jacques's full-sized avatar
🎯
Focusing

Jacques Marneweck jacques

🎯
Focusing
View GitHub Profile
@jperkin
jperkin / gist:3776050
Created September 24, 2012 13:50
Solve jsonn/pkgsrc.git breakage

The problem

jsonn/pkgsrc.git, our upstream repository, has been corrupted due to the cvs conversion from cvs.netbsd.org going awry with 'cvs admin -m' usage.

The issue is manifest when trying to merge:

$ git remote -v
origin  [email protected]:joyent/pkgsrc.git (fetch)
origin  [email protected]:joyent/pkgsrc.git (push)
@nikic
nikic / password_hashing_api.md
Created September 12, 2012 15:04
The new Secure Password Hashing API in PHP 5.5

The new Secure Password Hashing API in PHP 5.5

The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:

Why do we need a new API?

Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.

@ryanschwartz
ryanschwartz / mount_usbkey_userfiles.sh
Created May 16, 2012 21:44
SMF script to allow global zone user/group modification
#!/usr/bin/bash
case "$1" in
'start')
if [[ -n $(/bin/bootparams | grep '^smartos=true') ]]; then
if [[ -z $(/usr/sbin/mount -p | grep 'passwd') ]]; then
if [[ /etc/passwd -ot /usbkey/passwd ]]; then
cp /usbkey/passwd /etc/passwd
else
cp /etc/passwd /usbkey/passwd
@ryanschwartz
ryanschwartz / compiler_patch
Created April 25, 2012 16:19
Joyent SmartMachine SMF manifest for hand-built nginx with --prefix=/opt/local/nginx
--- lib/phusion_passenger/platform_info/compiler.rb.orig 2012-04-25 16:23:34.773244791 +0000
+++ lib/phusion_passenger/platform_info/compiler.rb 2012-04-25 16:21:21.044674989 +0000
@@ -142,8 +142,8 @@
end
if RUBY_PLATFORM =~ /solaris/
- flags << '-pthreads'
- flags << '-D_XOPEN_SOURCE=500 -D_XPG4_2 -D__EXTENSIONS__ -D__SOLARIS__ -D_FILE_OFFSET_BITS=64'
+ flags << '-pthreads -std=c99'
+ flags << '-D_XOPEN_SOURCE=500 -D_XPG6 -D__EXTENSIONS__ -D__SOLARIS__ -D_FILE_OFFSET_BITS=64'
@jonavon
jonavon / CIDR.php
Created March 13, 2012 13:50
CIDR class for IPv4
<?php
/**
* CIDR.php
*
* Utility Functions for IPv4 ip addresses.
* Supports PHP 5.3+ (32 & 64 bit)
* @author Jonavon Wilcox <[email protected]>
* @revision Carlos Guimarães <[email protected]>
* @version Wed Mar 12 13:00:00 EDT 2014
*/
# This document describes updating the SmartOS boot_archive and /usr volumes.
#
# The boot_archive effectively contains /. If you want to make changes to SMF
# or so forth, you need to update the boot_archive.
#
# If you want to add things to /usr, such as drivers, you will need to update
# usr.lgz. It is compressed, so note the lofiadm -U and -C calls below. Once
# you have updated usr.lgz you will need to copy it back to the mounted
# boot_arhive.
#
@nstielau
nstielau / check_ohai_load_times.rb
Created October 28, 2011 21:22
Check the load times of Ohai plugins
#!/usr/bin/env ruby
# Check on the load times for Ohai plugins.
# To disable from chef-solo and chef-client runs see
# http://wiki.opscode.com/display/chef/Disabling+Ohai+Plugins
require 'benchmark'
require 'rubygems'
require 'ohai'
@ihumanable
ihumanable / Excel.php
Last active February 6, 2024 06:24
Simple Excel Writer in PHP
<?php
/**
* Simple excel writer class with no external dependencies, drop it in and have fun
* @author Matt Nowack
* @link https://gist.github.com/ihumanable/929039/edit
* @license Unlicensed
* @version 1.0
*/
class Excel {
def humanize secs
[[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].map{ |count, name|
if secs > 0
secs, n = secs.divmod(count)
"#{n.to_i} #{name}"
end
}.compact.reverse.join(' ')
end
@ry
ry / https-hello-world.js
Created January 4, 2011 00:03
new node https api
// curl -k https://localhost:8000/
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
https.createServer(options, function (req, res) {