Skip to content

Instantly share code, notes, and snippets.

View ya-mouse's full-sized avatar

Anton Burticica ya-mouse

  • Romania
View GitHub Profile
@ya-mouse
ya-mouse / collector.lua
Created August 26, 2016 13:53
Collector
local nixio = require 'nixio'
local bit = require 'bit'
local uloop = require 'uloop'
local ipmi = require 'ipmi'
local sub = string.sub
local byte = string.byte
local band = bit.band
uloop.init()
@ya-mouse
ya-mouse / ipmi.lua
Last active February 11, 2022 11:43
IPMI LAN and OpenIPMI interface classes
local bin = require 'struct'
local bit = require 'bit'
local nixio = require 'nixio'
local ffi = require 'ffi'
local fopen = nixio.open
local hash = nixio.crypto.hash
local stpack, stunpack = bin.pack, bin.unpack
local bor, band, bxor, lshift, rshift = bit.bor, bit.band, bit.bxor, bit.lshift, bit.rshift
local byte, sub = string.byte, string.sub
@ya-mouse
ya-mouse / 1428.sh
Last active November 30, 2015 10:17
Импорт данных в InfluxDB 0.9.x из data.mos.ru. Для отображения нужна Grafana 2.5.x.
#!/bin/bash
mkdir -p /tmp/im.$$
curl -s http://data.mos.ru/opendata/export/2002/csv | funzip -p | iconv -fcp1251 |
gawk -F ";" -vyes=0 -vno=0 -vunk=0 -vspecial=0 -vtotal=0 -vday=-1 '
NR % 2 == 0 {
d=$3 " " $4
gsub(/\./, "/", d)
d=gensub(/\//, " ", 3, d)
@ya-mouse
ya-mouse / general.h
Created June 11, 2014 08:10
iPXE configuration
#ifndef CONFIG_LOCAL_GENERAL_H
#define CONFIG_LOCAL_GENERAL_H
/** @file
*
* General configuration
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
@ya-mouse
ya-mouse / get-task.sh
Last active August 29, 2015 13:58
crowdgorod data mining
#!/bin/sh -e
wd=$PWD/$1
prj=http://crowdgorod.mos.ru
[ -n "$1" ] || exit 1
# Если ещё не получили список предложений,
# создаём рабочую директорию и загружаем предложения
@ya-mouse
ya-mouse / bitwise-u16
Created January 15, 2014 21:08
Wrong type casting leads to wrong value
use std::io::println;
fn main() {
let m : [u8, ..1] = [ 0u8 ];
println(format!("{}", ((m[0] >> 8) | 0) as u16));
println(format!("{}", ((m[0] >> 8) | m[0]) as u16));
assert!((((m[0] >> 8) | 0) as u16) == 0);
assert!((((m[0] >> 8) | m[0]) as u16) == 255);
}