Skip to content

Instantly share code, notes, and snippets.

@kjseefried
kjseefried / Gen_Buffer.adb
Created July 15, 2014 00:33
Example of calling a C OpenGL function from Ada.
function Gen_Buffers (Count : in Sizei) return Uint_Array is
Gen_Buffers : access procedure
(Count : in Sizei;
Buffers : out Uint_Array);
pragma Import (C, Gen_Buffers, "__glewGenBuffers");
Buffers : Uint_Array (1 .. Positive (Count));
begin
Gen_Buffers (Count, Buffers);
return Buffers;
@kjseefried
kjseefried / InterestingExceptions.py
Created July 15, 2014 00:17
Interesting low-level python exceptions to look at later.
InterestingExceptions = [EXCEPTION_ACCESS_VIOLATION,
EXCEPTION_ARRAY_BOUNDS_EXCEEDED,
EXCEPTION_DATATYPE_MISALIGNMENT,
EXCEPTION_ILLEGAL_INSTRUCTION,
EXCEPTION_IN_PAGE_ERROR,
EXCEPTION_PRIV_INSTRUCTION,
EXCEPTION_STACK_OVERFLOW]
@kjseefried
kjseefried / filename.adb
Created July 14, 2014 19:18
3 ways to create filelname of form "base" + number + suffix
I: Integer := 1;
Base: String := "file";
Suffix: String := ".data";
file_name: String;
-- 1
file_name : String := Base & Ada.Strings.Fixed.Trim(Integer'Image(I), Ada.Strings.Left) & Suffix;
-- 2
@kjseefried
kjseefried / uuencode.c
Created July 13, 2014 17:32
uuencode - it's a classic
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that a{z documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
@kjseefried
kjseefried / smb-snip.sh
Created July 13, 2014 17:19
script that shows accessible smb-netbios shares in a given ip-range - snip (c) copyright 2000 by plasmoid / thc <plasmoid@pimmel.com> - not sure where I found it
#!/bin/sh
# snip (c) copyright 2000 by plasmoid / thc <plasmoid@pimmel.com>
#
# snippy lil' snip script that shows accessible smb-netbios shares
# in a given ip-range. - requires smbclient and nbtscan.
#
# $Id: snip.sh,v 1.1.1.1 2006/10/29 20:33:13 plasmoid Exp $
# set the right paths here, if smbclient and nbtscan are not within your
# path.
@kjseefried
kjseefried / udpflood.py
Created July 13, 2014 17:13
Advanced Multithreaded UDP Flooder coded by Fl0urite - don't recall where I found it
#!/usr/bin/python
# Advanced Multithreaded UDP Flooder coded by Fl0urite
# leak.sx
# Hope u leik!
import os
import sys
import time
import socket
import random
from threading import Thread
@kjseefried
kjseefried / webcrawl.py
Last active August 29, 2015 14:03
Simple web spider
import urllib,re
url=raw_input('Enter Url : ')
try:
html=urllib.urlopen(url).read()
except:
print "can't open web site"
exit()
links=re.findall('href="(http://.*?)"',html)
@kjseefried
kjseefried / Simulate IMPORT FOREIGN SCHEMA
Created July 13, 2014 15:53
The query will create SQL to run on the one you're trying to create the foreign table to, to establish all tables in the DB as foreign ones.
SELECT
'CREATE FOREIGN TABLE '
|| quote_ident('#{prefix}_' || c.relname)
|| '(' || array_to_string(array_agg(quote_ident(a.attname) || ' ' || t.typname), ', ') || ') '
|| ' SERVER #{prefix}_db OPTIONS'
|| ' (schema_name ''' || quote_ident(n.nspname) || ''', table_name ''' || quote_ident(c.relname) || ''');'
FROM
pg_class c,
pg_attribute a,
pg_type t,
@kjseefried
kjseefried / ubuntu lvm clone-resize
Last active June 20, 2023 17:35 — forked from anonymous/gist:fdcbcc27278c287ce5e0
clone & resize Ubuntu Cloud image from 2GB to 40GB in 2 seconds
# time ./do-all.sh
+ lvcreate -kn -s -n ubunt2 /dev/k2/ubunt
Logical volume "ubunt2" created
+ lvresize -L 40G /dev/k2/ubunt2
Extending logical volume ubunt2 to 40.00 GiB
Logical volume ubunt2 successfully resized
+ echo -en 'd\nn\np\n\n\n\n\n\nw\nq\n'
+ fdisk /dev/k2/ubunt2
Command (m for help): Selected partition 1
[General]
arch=amd64
cleanup=true
noauth=true
ignorenativearch=true
unpack=true
aptsources=Debian
bootstrap=Debian
[Debian]