Skip to content

Instantly share code, notes, and snippets.

View anapsix's full-sized avatar
😺

Anastas Dancha anapsix

😺
View GitHub Profile

Install OS X 10.10 Yosemite in VirtualBox

(based on this pastebin i've found via Google, markdownified and adjusted to work with the official Yosemite release)

Yosemite's first developer preview was released right after Monday's WWDC opening keynote. For the general public, an open beta will be available to download later this summer. However, for those who want a sneak peek at the new hotness, there is a way to safely install it without risking your machine, using the free and powerful VirtualBox application from Oracle.

(LEGAL DISCLAIMER: This guide aims to explain how to create a virtual machine on a regularly purchased Apple computer, running a genuine Mac OS X operating system, for testing purposes only.)

@anapsix
anapsix / bogons_check.rb
Last active August 29, 2015 14:15
Check an IP Address agains Bogons list by turning it into an integer
#!/usr/bin/env ruby
#
# @author: Anastas Dancha <anapsix@random.io>
# @note: This script checks given IPv4 address against Bogons list
# by turnning IPs into integers, IP Ranges into integer ranges
# and using integer comparison.
# @note: Bogons list is retrieved during runtime from http://www.team-cymru.org
# @note: using binary math is way cooler,
# but integers are easier to understand.
# @note: make sure to have required gems installed
@anapsix
anapsix / eventbrite_tickets_count.md
Last active October 7, 2015 18:21
eventbrite tickets count

remaining tickets count from Eventbrite, without API key

@anapsix
anapsix / BUNDLER-adding-sqlite3-support.patch
Created November 18, 2013 19:59
GitLab-CI PATCH:: BUNDLER: adding sqlite3 support
From b8abbcc636dad8271477352315da1e9a575b853c Mon Sep 17 00:00:00 2001
From: Anastas Semenov <anapsix@random.io>
Date: Mon, 18 Nov 2013 19:23:18 +0000
Subject: [PATCH] BUNDLER: adding sqlite3 support
---
Gemfile | 5 +++--
Gemfile.lock | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
@anapsix
anapsix / gitlabci_config.rb
Last active December 28, 2015 19:18
GitLAB-CI config
#!/usr/bin/env ruby
require 'yaml'
require 'getoptlong'
GITLAB_HOME = File.expand_path('../',__FILE__)
$app_config_file = GITLAB_HOME + '/config/application.yml'
$db_config_file = GITLAB_HOME + '/config/database.yml'
$puma_config_file = GITLAB_HOME + '/config/puma.rb'
@anapsix
anapsix / get_elb_logs.sh
Last active January 30, 2017 18:45
Getting ELB logs from S3 via SQS queue at maximum warp
#!/usr/bin/env bash
#================================================================
# DESCRIPTION
# Script retrieves files from S3 via SQS at maximum warp.
#================================================================
# AUTHOR Anastas Dancha (@anapsix)
# COPYRIGHT Copyright (c) Anastas Dancha (@anapsix)
# LICENCE GNU General Public License
#================================================================

Keybase proof

I hereby claim:

  • I am anapsix on github.
  • I am anapsix (https://keybase.io/anapsix) on keybase.
  • I have a public key ASAqGKWc6Gg5in_d1Fd22gENDnm8vWd5zrPo758smzTpxAo

To claim this, I am signing this object:

@anapsix
anapsix / getting_ips_in_Javascript_and_CoffeeScript.md
Created December 22, 2017 13:09
How to get interface IP in JavaScript/NodeJS and CoffeeScript

JavaScript

function getInterfaceIPv4(iface) {
  var iface_info = os.networkInterfaces()[iface];
  var addresses = [];
  //console.log(iface_info);
  for (var k in iface_info) {
    var address = iface_info[k];
    //console.log(address);
 if (address.family === 'IPv4') {
@anapsix
anapsix / check_http.sh
Created January 9, 2018 09:20
Check URL and return timing, http code, number of redirects, and effective url
#!/usr/bin/env bash
#
# returns the following
# [curl exit code],[total request time],[http response code],[number of redirects],[effective url]
#
if [[ ${1} == '' ]]; then
echo >&2 'missing URL to check'
echo >&2 "Usage: $0 google.com"
exit 1
@anapsix
anapsix / lockcreen.md
Created February 8, 2018 15:18
lockscreen command line utility on mac

Make a lockscreen CLI utility on your Mac

ATTENTION: use at your own risk, no warranty of any kind This seems to work in High Sierra, but may break in future versions

cat > /tmp/lockscreen.c <<EOF
// lockscreen.c
extern void SACLockScreenImmediate();
int main()
{