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
prom@kitten:~$ cli help sho | |
configuration interface log route | |
prom@kitten:~$ cli help sho interface | |
SHOW INTERFACE | |
Query the interface database | |
prom@kitten:~$ cli shell | |
> sh |
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
for(char in string, offset from 0) | |
select(state) | |
#"initial" => | |
case | |
char.whitespace? => | |
maybe-push-collected(); | |
char = '"' => | |
state := #"dquote"; | |
char = '?' => | |
if(collected-start) |
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
define cli-command $root (fnord) | |
help "Fnord, whatever that means..."; | |
named parameter file :: <cli-file>, | |
must-exist?: #t; | |
named parameter oneof :: <cli-oneof>, | |
alternatives: #("bla", "blubb", "boo"); | |
end; |
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
prom@horsey:/extra/Projects/opendylan/libraries/command-interface$ _build/bin/command-interface-demo | |
> | |
Commands: | |
configure - Modify configuration | |
show - Show information | |
echo - Command | |
directory - Show information about directory | |
examine - Command | |
error - Fail miserably | |
quit - Quit the shell |
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 <stdlib.h> | |
#include <stdio.h> | |
int main(int argc, char **argv) { | |
unsigned word; | |
int count; | |
/* check for argument */ | |
if(argc < 2) { printf("Usage: %s INTEGER\n", argv[0]); abort(); } | |
/* convert argument */ | |
word = (unsigned)atoi(argv[1]); | |
/* count number of 1-bits */ |
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 | |
# qubes.GetHostsFile - RPC service for retrieving a hosts file | |
# | |
# This will emit a hosts file containing the addresses of all qubes | |
# directly connected to the qube calling the service. | |
# | |
# It can be used in firewall VMs to get name resolution for these VMs. | |
# | |
# Note that using this script might create an information leak. |
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/sh | |
# qvm-restart <domain> | |
# | |
# Restart the given Qubes DOMAIN, reattaching | |
# all its network dependents as needed. | |
# | |
set -e |
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 <errno.h> | |
#include <locale.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <wchar.h> | |
#include <unistd.h> | |
int main(int argc, char **argv) { | |
int res, i; | |
char buf[64]; |
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
Example use: | |
# qubes control | |
bindsym $mod+u exec --no-startup-id "qubes-i3-dmenu-shell --start" | |
bindsym $mod+Shift+u exec --no-startup-id "qubes-i3-dmenu-shell --pause" | |
bindsym $mod+i exec --no-startup-id "qubes-i3-dmenu-shell --shutdown" | |
bindsym $mod+Shift+i exec --no-startup-id "qubes-i3-dmenu-shell --unpause" | |
# qubes launching | |
bindsym $mod+o exec --no-startup-id "qubes-i3-dmenu-shell --global" |
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 little program uses a SIGSEGV handler to auto-map pages as they are used. | |
// If you want you can use this to program without a memory allocator. | |
// gcc -std=c11 -Wall -Wextra -g -o allmem allmem.c /usr/lib/x86_64-linux-gnu/libsigsegv.a | |
#define _GNU_SOURCE 1 | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <errno.h> | |
#include <fcntl.h> | |
#include <limits.h> | |
#include <pthread.h> |
OlderNewer