Skip to content

Instantly share code, notes, and snippets.

View n0099's full-sized avatar
🏳️‍⚧️
HRT 24-11-01

n0099 n0099

🏳️‍⚧️
HRT 24-11-01
View GitHub Profile
@fogus
fogus / 0 - UNIX Fifth Edition
Created July 20, 2011 00:15
UNIX V5, OpenBSD, Plan 9, FreeBSD, and GNU coreutils implementations of echo.c
main(argc, argv)
int argc;
char *argv[];
{
int i;
argc--;
for(i=1; i<=argc; i++)
printf("%s%c", argv[i], i==argc? '\n': ' ');
}
@kylemanna
kylemanna / 7z+tar.md
Last active September 5, 2024 10:15
Archive with tar + 7z + max compression

Overview

7-zip doesn't preserve the Linux/Unix owner/group of files and possibly other details. Use tar instead because it's designed to preserve these things, then just 7zip the tar archive.

Create the archive

tar cf - --exclude=\*.o -v directory | 7z a -si -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on directory.tar.7z
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@CHH
CHH / 00_rfc_decorators.md
Last active November 22, 2024 14:48
PHP Decorators RFC

PHP Decorators (alternative proposal to Annotations)

Inspiration: Python Decorators

Todo

  • Further refine how class decorators should work. Should they work on the instance level? Or should they just receive the class name, and can only be used for providing metadata? Instance level is probably the only one that makes sense in PHP. Problem is though, that then the decorator is not called when used in the declaration.
@jgrahamc
jgrahamc / loc_parser.go
Created March 27, 2014 13:43
DNS LOC textual record parser
// loc_parser: functions to parse the textual part of a LOC record
// stored in our DNS. The key function here is parseLOCString which
// should be passed a dns.LOC and a string containing the latitude,
// longitude etc.
//
// This is an implementation of RFC 1876. Read it for background as
// the format in a dns.LOC is slightly unusual.
//
// Copyright (c) 2014 CloudFlare, Inc.
@magnetikonline
magnetikonline / README.md
Last active April 23, 2025 12:33
Setting Nginx FastCGI response buffer sizes.
@szepeviktor
szepeviktor / do-fontdetect.js
Created May 19, 2014 17:44
JavaScript/CSS Font Detector by Lalit Patel
// loading on "load" may cause FOUC
window.onload = function() {
var detective = new Detector();
if (!detective.detect('Meat')) {
var url = 'link/to/style.css'
if (document.createStyleSheet) {
try { document.createStyleSheet(url); } catch (e) { }
} else {
var css;
@tomconte
tomconte / snapshot_utility.py
Created July 23, 2014 16:25
Sample Python script to manage Azure Blob Storage snapshots: list snapshots, take a snapshot, delete a snapshot, copy a snapshot to a new Blob.
#!/usr/bin/python
from azure.storage import BlobService
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("container", help="the blob container")
parser.add_argument("blob", help="the blob name")
parser.add_argument("-s", "--snapshot", help="take a new snapshot", action="store_true")
parser.add_argument("-d", "--delete", help="delete a snapshot")
#!/bin/bash
fsWithSnapshots=$(zfs list -Hr -t snapshot tank/share |grep '@' |cut -d '@' -f 1 |uniq)
for fs in $fsWithSnapshots ; do
# Changed to now sort newest to oldest. This will mean that newer snapshots without deltas will get removed.
emptySnapshot=$(zfs list -Hr -d1 -t snapshot -o name,used -S creation $fs |sed '$d' |awk ' $2 == "0B" { print $1 }' )
for snapshot in $emptySnapshot ; do
# Added safety check. Verify the size of the snapshot prior to destroying it
@tsolar
tsolar / laravel-subdirectory.conf
Last active February 5, 2025 05:29
Laravel in subdirectory nginx example
server {
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 300M;
sendfile on;
send_timeout 300s;
# Port that the web server will listen on.
#listen 80;