Skip to content

Instantly share code, notes, and snippets.

View ohadcn's full-sized avatar

ohad ohadcn

  • rehovot/jerusalem, israel
View GitHub Profile
@ohadcn
ohadcn / iframe.html
Created May 27, 2020 09:44
full page iframe template to be used as transparetn redirect
<html>
<head>
<style>
html body iframe {
height: 100%;
width: 100%;
}
body {
border: 0;
margin: 0;
@ohadcn
ohadcn / README.md
Last active September 8, 2020 19:02
nginx templates

nginx config template and include files

to use this:

  • put the files in /etc/nginx/ 1.

  • duplicate nginx-site-template into /etc/nginx/sites-enabled to every site you want to serv.2

  • depending on your php version, edit php_srv fastcgi_pass location.

pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
contract CveDateViews is usingOraclize {
string public cveCount;
string public url;
string public prod;
string public vendor; // date
@ohadcn
ohadcn / Buffer.json
Created October 22, 2018 07:48
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
{
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
@ohadcn
ohadcn / card.sol
Last active May 16, 2018 08:06
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.23+commit.124ca40d.js&optimize=false&gist=
pragma solidity ^0.4.23;
// pragma experimental ABIEncoderV2;
library HandLib {
// enum HAND_TYPES { HIGH_CARD, ONE_PAIR, TWO_PAIRS, THREE, STRAIGHT, FLUSH, FULL_HOUSE, FOUR, STRAIGHT_FLUSH}
// mapping(HAND_TYPES => uint8) handRank { HIGH_CARD: 0, ONE_PAIR: 1, TWO_PAIRS: 2, THREE: 3, STRAIGHT: 4, FLUSH: 5, FULL_HOUSE: 5, FOUR: 6, STRAIGHT_FLUSH: 7}
function getCardRank(uint8 card) private pure returns (uint8 rank) {
require(card < 52);
@ohadcn
ohadcn / card.sol
Created May 16, 2018 01:37
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.23+commit.124ca40d.js&optimize=false&gist=
pragma solidity ^0.4.23;
// pragma experimental ABIEncoderV2;
library HandLib {
// enum HAND_TYPES { HIGH_CARD, ONE_PAIR, TWO_PAIRS, THREE, STRAIGHT, FLUSH, FULL_HOUSE, FOUR, STRAIGHT_FLUSH}
// mapping(HAND_TYPES => uint8) handRank { HIGH_CARD: 0, ONE_PAIR: 1, TWO_PAIRS: 2, THREE: 3, STRAIGHT: 4, FLUSH: 5, FULL_HOUSE: 5, FOUR: 6, STRAIGHT_FLUSH: 7}
function getCardRank(uint8 card) private pure returns (uint8 rank) {
require(card < 52);
@ohadcn
ohadcn / card.sol
Created May 15, 2018 21:13
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.23+commit.124ca40d.js&optimize=false&gist=
pragma solidity ^0.4.23;
// pragma experimental ABIEncoderV2;
library HandLib {
// enum HAND_TYPES { HIGH_CARD, ONE_PAIR, TWO_PAIRS, THREE, STRAIGHT, FLUSH, FULL_HOUSE, FOUR, STRAIGHT_FLUSH}
// mapping(HAND_TYPES => uint8) handRank { HIGH_CARD: 0, ONE_PAIR: 1, TWO_PAIRS: 2, THREE: 3, STRAIGHT: 4, FLUSH: 5, FULL_HOUSE: 5, FOUR: 6, STRAIGHT_FLUSH: 7}
function getCardRank(uint8 card) private pure returns (uint8 rank) {
require(card < 52);
@ohadcn
ohadcn / New machine
Last active February 15, 2023 19:55
install commonly used packages on new machine installation
few usefull scripts to configure and install a new development machine.
every file contains staff to be installed in a selected way, every line is for kind of develpers / development process.
@ohadcn
ohadcn / MIddleClick.ahk
Last active November 10, 2017 14:38
asus laptop shortcuts fix using autohotkey
;this script replaces `F22` button with middle mouse click.
;F22 button is is the trigger fired on touchpad three fingers click
;compile it and put it in your startup directory
#Persistent
<#^+F22::Send {mbutton}
#!/bin/bash
export ROS_VERSION=lunar
sudo apt-add-repository -y universe
sudo apt-add-repository -y multiverse
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get install -y ros-$ROS_VERSION-desktop-full python-rosinstall htop zip unzip build-essential rar unrar
sudo rosdep init