Skip to content

Instantly share code, notes, and snippets.

View citrin's full-sized avatar

Anton Yuzhaninov citrin

View GitHub Profile
@citrin
citrin / StandardKeyBinding.dict
Created March 26, 2019 10:14
Default key bindings in Mac OS X
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key></key>
<string>insertNewline:</string>
<key></key>
<string>deleteBackward:</string>
<key> </key>
<string>insertTab:</string>
#!/usr/bin/perl
use strict;
use warnings;
use Net::CIDR::Lite;
my $cidr = Net::CIDR::Lite->new;
while (<>) {

Yandex

> drill -p 5553 rs.dns-oarc.net TXT @127.0.0.1 | fgrep TXT
;; rs.dns-oarc.net.     IN      TXT
rst.x490.x485.x476.rs.dns-oarc.net.     0       IN      TXT     "77.88.46.165 DNS reply size limit is at least 490"
rst.x490.x485.x476.rs.dns-oarc.net.     0       IN      TXT     "Tested at 2016-08-12 14:01:12 UTC"
rst.x490.x485.x476.rs.dns-oarc.net.     0       IN      TXT     "77.88.46.165 lacks EDNS, defaults to 512"
threads | atomic | rwlock
------- | ------ | ------
1 | 41.30 | 19.24
2 | 19.03 | 9.04
8 | 5.40 | 1.37
24 | 1.89 | 0.34
> uname -srp
FreeBSD 10.0-STABLE-20140718 amd64
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h> /* LLADDR */
#include <ifaddrs.h>
#include <err.h>
#include <stdlib.h>
#include <stdio.h>
@citrin
citrin / top.sh
Last active August 29, 2015 13:57
#!/bin/sh
dir=`dirname $0`
logfile=$dir/`date +%F`.log
#TOP='top -jabtS -d1 -ores 1024'
TOP='top -d1 -Unobody -abtSH 128'
date +'%F %T' >> $logfile
$TOP >> $logfile
echo ------------------------------------------------------------------------------- >> $logfile
#!/usr/bin/perl
use 5.012;
use warnings;
my @cpu_times = split /\s+/, `sysctl -n kern.cp_times`;
die "xxx" unless @cpu_times;
my $cnt1 = [];
my $cnt2 = [];
@citrin
citrin / timer.c
Created June 6, 2013 18:33
test case to debug long sleeps
#include <sys/time.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define SLEEP_FOR 5
int
@citrin
citrin / range2cidr.c
Created December 4, 2012 11:28
Convert IPv4 range to list of CIDR prefixes
#include <arpa/inet.h>
#include <assert.h>
#include <err.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#define IPv4_BITS 32