Skip to content

Instantly share code, notes, and snippets.

View briangreenery's full-sized avatar

Brian Green briangreenery

  • San Francisco, CA
View GitHub Profile
@briangreenery
briangreenery / set_password_policy.sh
Last active December 29, 2015 03:09
Set the console user password policy on a linux server
#!/bin/sh
# The location of the iem tool
IEM=/opt/BESServer/bin/iem
# The password regex
REGEX="A+B+"
# The password description
DESCRIPTION="Your password needs some As then some Bs"
#include <stdio.h>
#include <utmp.h>
int main()
{
setutent();
struct utmp* entry;
for ( entry = getutent(); entry; entry = getutent() )
{
@briangreenery
briangreenery / free_size.c
Created November 23, 2013 00:09
(Incorrectly) calculate the free size of the directory
#include <stdio.h>
#include <inttypes.h>
#include <sys/statvfs.h>
typedef unsigned long long uint64;
uint64 get_free_size( const char* path )
{
struct statvfs buffer;
if ( statvfs( path, &buffer ) != -1 )
@briangreenery
briangreenery / statvfs.c
Last active December 29, 2015 09:28
Calculate the free size of a directory using statvfs and statvfs64
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/statvfs.h>
static int print_bytes_free_32( const char* directory )
{
struct statvfs buf32;
if ( statvfs( directory, &buf32 ) == -1 )
  • Korean BBQ party
  • Fantasy Football Pizza party
  • Sushi for platform team
  • Shotgun tournament (dead serious)
  • Fashion week
  • Honda party
#!/bin/bash
# This script builds and installs clang on the Red Hat 6.0 build machine.
GCC=$HOME/gcc
CLANG=$HOME/clang
# Install prereqs
sudo yum install -y svn glibc-devel.i686
@briangreenery
briangreenery / p4v.desktop
Created April 15, 2014 00:35
Ubuntu Perforce Launcher
[Desktop Entry]
Type=Application
Name=P4V
Comment=Perforce Visual Client
Icon=/opt/p4/lib/p4v/P4VResources/icons/P4-V_96x96-badge.png
Exec=/opt/p4/bin/p4v
Terminal=false
Categories=Development
PS1='\[\e[0;36m\]\u \[\e[0;32m\]\w\[\e[0m\]$(__git_ps1 " (%s)")\nλ '
if [ -n "$SSH_CLIENT" ]; then
PS1="(ssh) $PS1"
fi
<setting name='port' type='int'>1533</setting>
<setting name='force_login' type='bool'>1</setting>
<setting name='fake_client_id' type='bool'>1</setting>
<setting name='server' type='string'>messaging.ibm.com</setting>
<setting name='client_id_val' type='int'>4661</setting>
var fs = require('fs');
var path = 'text.txt',
size = 64*1024*1024;
fs.open(path, 'w', '666', function(err, fd) {
if (err) {
return console.log(err);
}