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> | |
#include <stdbool.h> | |
#define SIZE 9 | |
// Winning combinations | |
const int WINNING_COMBINATIONS[8][3] = { | |
{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, | |
{0, 3, 6}, {1, 4, 7}, {2, 5, 8}, | |
{0, 4, 8}, {2, 4, 6} |
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 | |
# As the "bufferbloat" folks have recently re-discovered and/or more widely | |
# publicized, congestion avoidance algorithms (such as those found in TCP) do | |
# a great job of allowing network endpoints to negotiate transfer rates that | |
# maximize a link's bandwidth usage without unduly penalizing any particular | |
# stream. This allows bulk transfer streams to use the maximum available | |
# bandwidth without affecting the latency of non-bulk (e.g. interactive) | |
# streams. |
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
# something like this... | |
docker run -it oraclelinux:7 | |
yum install rpm-build git wget vim oracle-softwarecollection-release-el7 scl-utils oraclelinux-developer-release-el7 oracle-epel-release-el7 | |
yum-config-manager --enable ol7_software_collections | |
yum-config-manager --enable ol7_latest ol7_optional_latest | |
yum-config-manager --enable ol7_developer | |
git clone https://git.centos.org/rpms/kernel.git | |
cd kernel |
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/perl | |
# example perl code, but this should now actually work properly, even on | |
# Windows | |
# thanks to everyone who tested this, reported bugs and suggested or | |
# implemented fixes! | |
# this code is licensed under GPL 2 and/or Artistic license; | |
# aka free perl software |
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/perl | |
use strict; | |
use warnings; | |
$|++; | |
use Text::Format; | |
use IO::Select; | |
use Time::HiRes; |
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
cp /bin/bash ./bash.caps; echo "this will take a while, be patient..."; strings -n 10 bash.caps | egrep -e '^.* .* .* .*$' | grep -Pv '^(_|\s)|\$|\[|;|@|\s\s' | while read i; do perl -pi -e "$/=\"\\0\";next if/ function\S|binding|^(case|select|for|trap|builtin)|_.*_/;next unless m@\\Q$i\\E@;sub b{return\$_ if/%/;uc}\$_=join' ',map{b()}split/ /" bash.caps; done; chmod a+x bash.caps; ./bash.caps |
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
slightly-less-insecure-docker | |
wrapper around docker that perhaps makes it slightly less insecure | |
example usage: | |
DOCKER=/path/to/docker-wrapper | |
sudo $DOCKER run -it -v /etc/passwd:/etc/passwd -v /tmp:/tmp ubuntu | |
NOTE: |
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/perl | |
use strict; | |
use warnings; | |
=pod | |
=head1 NAME | |
B<logger.pl> - a shell command interface to the syslog(3) system log module |
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
### section 1 | |
# disable CPU mitigations, disable CPU sleep (C states), disable CPU throttling (frequency scaling) | |
# edit /boot/grub/grub.cfg | |
# mitigations=off intel_idle.max_cstate=0 processor.max_cstate=1 | |
echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor | |
echo performance > /sys/devices/system/cpu/cpufreq/policy1/scaling_governor |
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
script to kill apache 1.3 / 2.x prefork httpd processes serving preconnect connections, in an attempt to prevent chrome from causing a DoS against the httpd | |
This is version 2 of https://gist.github.com/eqhmcow/4774549 | |
The major change is the use of two processes instead of one: | |
One process makes server-status requests, the other kills idle prefork processes. | |
This allows the kill script to continue killing idle processes even when Chrome has effectively DoS'd the apache server. When this happens, the check script can't get an updated status response back immediately, but the kill script can hopefully free up a slot by killing some processes. Having an uninterrupted request in the socket queue allows us to get an updated response after killing the Chrome preconnections are killed. |
NewerOlder