Skip to content

Instantly share code, notes, and snippets.

View spiculator's full-sized avatar

Sergey Redin spiculator

View GitHub Profile
package main
import (
"fmt"
"math/big"
"os"
"strconv"
"time"
"unsafe"
)
@spiculator
spiculator / 0_reuse_code.js
Created January 22, 2014 06:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@spiculator
spiculator / +.c
Created May 26, 2014 13:30
print command and run it (like `make` does)
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
printf( "+" );
for( i = 1; i < argc; i++ )
printf( " %s", argv[i] );
printf( "\n" );
if( argc > 1 )
@spiculator
spiculator / jail.patch
Created June 18, 2014 14:58
fix vulnarability in jail chroot tool
diff --git a/src/jail.c b/src/jail.c
index ecf0cb3..9b1da64 100644
--- a/src/jail.c
+++ b/src/jail.c
@@ -453,8 +453,14 @@ int main(int argc, char *argv[], char *env[]) {
// call the shell overriding current process space
//
- setgid(gid);
- setuid(uid);
#!/usr/bin/perl -w
use strict;
use FindBin;
use Digest::MD5 qw/md5_hex/;
use Net::Whois::Raw;
use Storable qw/lock_retrieve lock_nstore/;
my $cache_file = "/var/tmp/domreg_sensor.cache";
my $default_whois_server = "whois.nic.ru";
my $cache_timeout = 6*60*60; # 6 hours
my $now = time;
@spiculator
spiculator / openfiles
Created May 29, 2015 14:43
List all open files sorted by size, including deleted files
#!/usr/bin/perl -w
use strict;
use Number::Bytes::Human qw/format_bytes/;
my $count = 30;
if( @ARGV ) {
die "Usage: $0 <count>\n" if @ARGV > 1;
$count = shift @ARGV;
die "bad count\n" unless $count =~ /^\d+/;
}
#!/usr/bin/perl -w
use strict;
use Cwd 'abs_path';
sub usage() {
die "Usage: $0 [-f] [-l] [-v] <path>
-f unmount subdirectories even if <path> is not mounted
-l use lazy umount
-v verbose mode\n";}