Skip to content

Instantly share code, notes, and snippets.

View vimishor's full-sized avatar

Alexandru Guzinschi vimishor

View GitHub Profile
@vimishor
vimishor / hldsStatus.php
Created March 26, 2012 11:25
Check hlds status and calculate latency.
<?php
/**
* hldsStatus class file.
*
* Check hlds status and calculate latency.
*
* @author Alexandru G.
* @link http://www.gentle.ro/
* @version 0.1.1
@vimishor
vimishor / ubuntu-server-guest-additions.md
Created February 18, 2013 12:15
Installing VirtualBox Guest Additions on Ubuntu Server

Tested on Ubuntu Server 12.04

  • Start the Ubuntu Server VM and insert the Guest Additions CD image (Devices menu, Install Guest Additions).

  • Mount CD Rom:

    $ sudo mount /dev/cdrom /media/cdrom
  • Install necessary build tools and dependencies:

@vimishor
vimishor / pass.js
Created April 20, 2013 18:00
javascript to reveal hidden passwords with asterisk
// paste in browser address bar:
javascript: var p=r(); function r(){var g=0;var x=false;var x=z(document.forms);g=g+1;var w=window.frames;for(var k=0;k<w.length;k++) {var x = ((x) || (z(w[k].document.forms)));g=g+1;}if (!x) alert('Password not found in ' + g + ' forms');}function z(f){var b=false;for(var i=0;i<f.length;i++) {var e=f[i].elements;for(var j=0;j<e.length;j++) {if (h(e[j])) {b=true}}}return b;}function h(ej){var s='';if (ej.type=='password'){s=ej.value;if (s!=''){prompt('Password found ', s)}else{alert('Password is blank')}return true;}}
@vimishor
vimishor / meh.py
Created December 6, 2021 12:54
Temp sample
def pop(initial_state, time):
state_cnt = [initial_state.count(i) for i in range(0, 9)]
for _ in range(0, time):
state_cnt = state_cnt[1:] + state_cnt[:1]
state_cnt[6] += state_cnt[8]
return sum(state_cnt)
def partOne(data):
return pop(data, 80)
@vimishor
vimishor / packagist-search.sh
Created April 29, 2015 06:50
Search packagist.org from CLI
#!/usr/bin/env sh
#
# Search packagist.org from CLI with support for sorting results by the number
# of downloads or favorites.
#
# Temporary solution for https://github.com/composer/packagist/issues/365
#
# Dependencies:
# - [curl](http://curl.haxx.se/)
# - [jq](http://stedolan.github.io/jq/)
@vimishor
vimishor / .twitter.config-example.json
Created October 31, 2012 11:35
Tweet from your terminal.
{
"oauth_consumer_key": "XXX",
"oauth_consumer_secret": "XXX",
"access_token": "XXX",
"access_token_secret": "XXX"
}
pub const Box = struct {
field: i32,
};
pub fn main() void {
var box = Box { .field = 0 };
box.*.field = 1; // crash aici
var boxPtr = &box;
@vimishor
vimishor / skype.bash
Created July 14, 2013 09:14
Skype install on ubuntu
sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update
sudo apt-get install skype && sudo apt-get -f install
@vimishor
vimishor / 503.html
Last active December 31, 2015 05:59
Custom 503 page while deploy on openshift | License: MIT
<!DOCTYPE html>
<html>
<head>
<title>Deploy in progress. Please try again in few minutes</title>
<style type="text/css" />
body {color: #666; text-align: center; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; sans-serif; margin:0; width: 800px; margin: auto; font-size: 14px; }
h1 { font-size: 56px; line-height: 100px; font-weight: normal; color: #456; }
h2 { font-size: 24px; color: #666; line-height: 1.5em; }
h3 { color: #456; font-size: 20px; font-weight: normal; line-height: 28px; }
hr { margin: 18px 0; border: 0; border-top: 1px solid #EEE; border-bottom: 1px solid white; }
<?php
// src/Foobar/Controller/FooController.php
namespace Foobar\Controller;
class FooController
{
public function helloAction($request)
{