This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' This is file libzib-0.9.3_TJF.bi. | |
' | |
' FreeBasic-Header file for libzip, translated with help of h_2_bi.bas by | |
' Thomas.Freiherr@gmx.net. | |
' | |
' Licence: | |
' | |
' libzib-0.9.3_TJF.bi is free software: you can redistribute it and/or modify | |
' it under the terms of the GNU General Public License as published by the | |
' Free Software Foundation, either version 3 of the License, or (at your |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h3>This article has been tested for the following Ubuntu versions:</h3> | |
<p> </p> | |
<ul> | |
<li> | |
<p><a href="https://wiki.ubuntuusers.de/Trusty_Tahr/">Ubuntu 14.04</a> Trusty Tahr</p> | |
</li> | |
<li> | |
<p><a href="https://wiki.ubuntuusers.de/Precise_Pangolin/">Ubuntu 12.04</a> Precise Pangolin</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "inflate.h" | |
int inflate(char *output, int *output_length, const char *input, int input_length) { | |
final_block = 0; | |
do { | |
get_block_type(); | |
switch(block_type) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void lngcpy(unsigned char *dst, int dst_length, unsigned char *const src, int src_length) { | |
if (dst_length <= src_length) { | |
memcpy(dst, src, dst_length); | |
} else { | |
/* src_length < dst_length */ | |
memcpy(dst, src, src_length); | |
memset(dst + src_length, 0, dst_length - src_length); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Game: given four different items, try to put them in order. | |
With each try, a number is returned indicating how many items are in their correct position. (As in a recent Crystal Maze game) | |
Challenge: find a strategy that minimises the (worst-case) number of moves needed to guess the order. | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
typedef unsigned char move_count; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include once "crt.bi" | |
#undef Rem | |
#define Rem | |
Dim Shared As Integer CHAR_DBLQUOTE = 34 | |
Dim Shared As Integer SYM_BAD = 0 | |
Dim Shared As Integer SYM_DATATYPE = 1 | |
Dim Shared As Integer SYM_VAR = 2 | |
Dim Shared As Integer SYM_PROC = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "crt.bi" | |
function merge(c1 as ulong, c2 as ulong, w as single) as ulong | |
dim as integer r1, g1, b1, r2, g2, b2 | |
dim as integer m = int(w * 256) | |
assert(m >= 0 and m < 256) | |
r1 = c1 shr 16 and 255: r2 = c2 shr 16 and 255 | |
g1 = c1 shr 8 and 255: g2 = c2 shr 8 and 255 | |
b1 = c1 and 255: b2 = c2 and 255 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# sha256sum each (megabyte-sized) block of /dev/sda, prepend the block number | |
# intent is to compare two drivesum lists and then dd out the changed blocks and send them to the other drive | |
device=/dev/sda | |
bs=1048576 | |
size=$(blockdev --getsize64 $device) | |
sumsfile=/tmp/sums_$(date +%s).txt | |
blocks=$(( ($size+$bs-1)/$bs )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Foreach ($VM in Get-VM){ | |
Write-Output $VM.name | |
Foreach ($HardDrive in $VM.HardDrives){ | |
$VHDPath = $HardDrive.path | |
Do { | |
Write-Output ("- " + $VHDPath) | |
$VHDPath = (Get-VHD -Path $VHDPath).ParentPath | |
} While ($VHDPath) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To use: adjust as needed, place in /etc/grub.d, make executable, run 'sudo update-grub' | |
# Ubuntu | |
# https://help.ubuntu.com/community/Grub2/ISOBoot/Examples | |
menuentry 'Ubuntu 12.04 (64-bit)' { | |
set isofile="/iso/ubuntu-12.04-desktop-amd64.iso" | |
loopback loop (hd0,1)$isofile | |
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject keyboard-configuration/layoutcode=gb | |
initrd (loop)/casper/initrd.lz | |
} |
OlderNewer