Skip to content

Instantly share code, notes, and snippets.

View vimishor's full-sized avatar

Alexandru Guzinschi vimishor

View GitHub Profile
@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)
pub const Box = struct {
field: i32,
};
pub fn main() void {
var box = Box { .field = 0 };
box.*.field = 1; // crash aici
var boxPtr = &box;
#!/usr/bin/env bash
#
# Register a new deploy-key on Bitbucket
#
# Usage: ./bitbucket-deploy-key.sh <username> <password> key-test ~/.ssh/id_rsa.pub vimishor my-super-repo
#
USERNAME=$1
PASSWORD=$2
@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 / pre-commit
Created April 14, 2015 19:31
Prevents debug traces and sensitive data to be commited.
#!/bin/sh
#
# Prevents debug traces and sensitive data to be commited.
#
# What to search for
FUNCTIONS='var_dump\(|phpinfo\(|print_r\('
# Prevent the commit if something is found.
# default: true
#!/bin/sh​
# Build Zsh from sources on Ubuntu.
# From http://zsh.sourceforge.net/Arc/git.html and sources INSTALL file.
# Some packages may be missing
sudo apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo
git clone git://zsh.git.sf.net/gitroot/zsh/zsh
cd zsh
@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)
{
@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 / gist:5950053
Last active December 19, 2015 11:49
Take notes inside your browser, with Sublime Text flavor.
// paste in address bar
data:text/html,<title>Browser Editor</title><style type="text/css">#e{font-size: 16px; position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/javascript");</script>