Skip to content

Instantly share code, notes, and snippets.

View ptdorf's full-sized avatar

Peter Wilmersdorf ptdorf

View GitHub Profile
@ptdorf
ptdorf / gist:1291236
Created October 16, 2011 18:27
Compile LAMP from source
===OPENSSL===
cd /opt/build
tar -zxvf ../downloads/openssl-1.0.0e.tar.gz
cd openssl-1.0.0e
./config --prefix=/usr/local
make
sudo make install
===APACHE2===
tar -zxvf ../downloads/httpd-2.2.19.tar.gz
@ptdorf
ptdorf / gist:1291467
Created October 16, 2011 21:49
realpath c source
//http://stackoverflow.com/questions/284662
// realpath.c: display the absolute path to a file or directory.
// Adam Liss, August, 2007
// This program is provided "as-is" to the public domain, without express or
// implied warranty, for any non-profit use, provided this notice is maintained.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ptdorf
ptdorf / gist:2371843
Created April 12, 2012 23:23
My modest skill set
Sun/AIX/Linux, .ASP, .NET, C#, compact framework, environment,
Framework, Project, programmer, Remoting, windows, services, 16-bit,
C, 2000, Server/Advanced, 2000/XP/2003, 2003, WDM, 2d/3d design, 2k,
32-bit, 3D, animation, Design, script, Engines, Graphics, Modeling,
Studio Max, StudioMax, 3dsmax, 8031, 8051, 8086, 95, 98, A+, ABAP,
ABAP/4, Access, add-ins, accounting, invoicing sys, Acrobat, Action
script, Active Directory, Object-Oriented, Active Perl, Active Server
Pages, Active X, Active Threed, Control, ActiveX, Plug-in, ActiveX/COM
APIs, AcuVoice, ADO, ADO.NET, Adobe, After Effects, Go Live, CS, Image
Ready, In Design, PageMaker, Photoshop, Premier, ADOX, ADSI, Advance
@ptdorf
ptdorf / 2048.c
Created April 15, 2017 00:46 — forked from justecorruptio/2048.c
Tiny 2048 in C!
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
@ptdorf
ptdorf / server.sh
Created April 15, 2017 00:47 — forked from justecorruptio/server.sh
Bash www server. Golfed from github.com/jaburns/ngincat
#!/bin/bash
:|((read f g h
[[ -f .$g&&$g != *..* ]]&&echo "$h 200 OK
"&&cat .$g)|nc -lp$1)>/dev/fd/0;$0 $1
site :opscode
cookbook 'apt'
cookbook 'nginx'
metadata
@ptdorf
ptdorf / gh-pages-deploy.md
Created August 2, 2017 19:58 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@ptdorf
ptdorf / example_local_file.tf
Created November 2, 2019 20:28 — forked from arnobroekhof/example_local_file.tf
Terraform 0.11.x loop through a map and create files with content based on a maps --> key, value
variable "object_list" {
type = "map"
default = {
content1 = "this is example content 1",
content2 = "this is example content 2"
}
}
resource "local_file" "local_files" {
count = "${length(var.object_list)}" # perform this action based on the amount of items in the map
@ptdorf
ptdorf / echo-server.yml
Created September 3, 2020 11:50 — forked from chukaofili/echo-server.yml
Echo Server Deployment
apiVersion: v1
kind: Namespace
metadata:
name: echoserver
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoserver
namespace: echoserver