This file contains 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 <stdio.h> | |
/* * | |
* Exercise 1-13. Write a program to print a histogram of the lengths of words in | |
* its input. It is easy to draw the histogram with the bars horizontal; a vertical | |
* orientation is more challenging. | |
* ---- | |
* ANSI C K&R - CHARACTER INPUT AND OUTPUT: PAGE 15 | |
* The quantities IS_LOWER, IS_UPPER, IS_ALPHA, MAXLEN, OUT and IN (macros) | |
* are symbolic constant, not variables, so they do not appear in declarations. |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<oval_definitions | |
xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5" | |
xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval-common-5 oval-common-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5 oval-definitions-schema.xsd"> | |
<generator> | |
<oval:product_name>Security StackExchange Question - 194557</oval:product_name> | |
<oval:schema_version>5.10</oval:schema_version> |
This file contains 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
const xmlStream = require('xml-stream') | |
, fs = require('fs') | |
var stream = fs.createReadStream(__dirname+'./filename.xml') | |
, xml = new xmlStream(stream) | |
xml.preserve('some_subnode', true) | |
xml.collect('subtime_from_some_subnode') | |
xml.on('endElement: item', function (node) { | |
console.log(node) |
This file contains 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
var EventEmitter = require('events').EventEmitter, | |
fs = require('fs'), | |
util = require('util') | |
var Event = new EventEmitter(), | |
readStream = fs.createReadStream(__dirname+'./filename.txt','utf8'), | |
writeStream = fs.createWriteStream(__dirname+'./filename_new.txt', {flags:'w'}), | |
tmp_txt = [], | |
v = { |
This file contains 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
#!/usr/bin/node | |
'use strict'; | |
String.prototype.bidTimeConvert = function () { | |
let month = ['Jan', 'Feb', 'Mar', 'Apr', 'Mar', 'May', 'Jun', 'Jul', 'Ago', 'Set', 'Oct', 'Nov', 'Dec']; | |
let fromTime = new Date(this.toString().split('.')[0]).toLocaleString(); | |
let fromMinutes = ((new Date(fromTime).getMinutes()).toString().length == 1) ? '0'+new Date(fromTime).getMinutes() : new Date(fromTime).getMinutes(); | |
return (new Date(fromTime).getHours() < 12) | |
? month[new Date(fromTime).getMonth()+1] +' '+new Date(fromTime).getDate()+' '+new Date(fromTime).getFullYear()+' '+(new Date(fromTime).getHours() + 12)+':'+fromMinutes+'AM' |
This file contains 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 expanded %install scriptlet will create automatically if a directory not exists. | |
# So, you do not need to worry with rpm .spec file to create directory. | |
%__spec_install_pre %{___build_pre}\ | |
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\ | |
mkdir -p `dirname "$RPM_BUILD_ROOT"`\ | |
mkdir "$RPM_BUILD_ROOT"\ | |
%{nil} |
This file contains 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
" Making the BASH dive into 'Shell Style Guide' for better readability. | |
" https://lug.fh-swf.de/vim/vim-bash/StyleGuideShell.en.pdf | |
" https://google.github.io/styleguide/shell.xml | |
syntax on " set syntax highlight turned on; | |
set tabstop=4 " set tabstop to tell vim how many columns a tab counts for. Linux kernel code expects each tab to be 8 columns wide. Visual studio expects each tab to be four columns wide. This is the only command here that will affect how existing text displays; | |
set expandtab " convertt tabs to spaces; | |
set shiftwidth=2 " indent is 2 spaces; | |
set softtabstop=2 " untab size of, instead single space; | |
set autoindent " always set autoindenting on; | |
" extras: |
This file contains 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 <stdio.h> | |
static inline void | |
cpuid_vendor(char *vendor) __attribute__((always_inline)); | |
void cpuid_write(char *); | |
int main(void) | |
{ | |
char cpu_vendor[13]; | |
cpuid_write(cpu_vendor); |
This file contains 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 | |
function check_v | |
{ | |
local v k="$1" | |
shift | |
for v; do [[ "$v" == "$k" ]] && | |
return 0; | |
done | |
return 1 |
This file contains 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
alert icmp $EXTERNAL_NET any -> $HOME_NET any (msg:"Unexpected data was detected on ICMP packet into Data Segment"; itype:0; icode:0; icmp_id:1; dsize:>0; classtype:tunneling; reference:url,github.com/inquisb/icmpsh; sid:123456; rev:0) | |
event_filter gen_id 1, sig_id 123456, type limit, track by_src, count 1, seconds 60 |