Skip to content

Instantly share code, notes, and snippets.

View gist:98cf1148a726fb93fd725f1c89d19880
:oc:du::du -sk * | sort -rn | awk '{{}out=$2; for(i=3;i<=NF;i{+}{+}){{}out=out" "$i{}}; print out{}}' | xargs -ia du -hs "a"
:oc:tcpcount::netstat -plan|grep :80|awk {{}'print $5'{}}|cut -d: -f 1|sort|uniq -c|sort -nk 1
:oc:udptcp::netstat -anp |grep 'tcp\|udp' | awk '{{}print $5{}}' | cut -d: -f1 | sort | uniq -c | sort -n
:oc:estab::netstat -ntu | grep ESTAB | awk '{{}print $5{}}' | cut -d: -f1 | sort | uniq -c | sort -nr
View whereistelinit.c
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char *argv[] ) {
FILE *fp;
char path[80];
fp = popen("/usr/bin/which telinit", "r");
View gist:265a0526d95b6bdf877781ce2cb60fd7
pool.installAllPatches
{
"pool": "df32b8d2-12e1-7a84-0490-7a8178247188",
"id": "df32b8d2-12e1-7a84-0490-7a8178247188"
}
{
"message": "SR required to create VDI",
"stack": "Error: SR required to create VDI
at Xapi._callee52$ (/usr/local/lib/node_modules/xo-server/dist/xapi/xapi/index.js:1627:12)
at tryCatch (/usr/local/lib/node_modules/xo-server/node_modules/regenerator-runtime/runtime.js:65:40)
View gist:5dcc28a767b543b47c15bd763583807f
>>> 262.2 / float(2.2)
119.18181818181817
>>> 262.2 / float(2.20462)
118.93206085402474
View isOdd.py
def isOdd(value):
numbers = list(range(0, 2147483647))
even = True
for num in numbers:
if even:
numbers.remove(num)
even = not even
if value in numbers:
# double check
if not isEven(value):
View gist:9c75f0cee1bc5a9204339fce0d72f55f
2.3.0 :047 > q.first[1]["name_label"]
=> "xenc"
2.3.0 :048 > q.select{|t| t[1]["name_label"].to_s == "xenc"}
=> {}
View tests.rb
def test_create_a
expected_name = 'test.example.com'
expected_address = '10.1.1.1'
expected_type = 'A'
args = {
:name => "#{expected_name}.",
:type => expected_type,
:ttl => @ttl,
:data => expected_address,
:enabled => true,
View ops-2001.yaml
---
- hosts: all
remote_user: nhanlon
become: yes
become_user: root
tasks:
- name: Remove splash=quiet from /etc/grub.conf
become: yes
replace:
path: /etc/grub.conf
View gist:85e3fe13eee21f1dc957ad2fecad2986
session.signIn
{
"email": "whoo?",
"password": "idk!",
"username": "whoo?"
}
{
"message": "too fast authentication tries",
"stack": "Error: too fast authentication tries
View simon.asm
TITLE MouseClickRecognition
INCLUDE \masm32\include\masm32rt.inc
INCLUDE \masm32\include\winmm.inc
INCLUDELIB \masm32\lib\winmm.lib
INCLUDE Irvine32_NOWIN.inc
.stack 8192h
REGION STRUCT
start COORD <>