Skip to content

Instantly share code, notes, and snippets.

View gmertk's full-sized avatar

Günay Mert Karadoğan gmertk

View GitHub Profile

Can't install fastecdsa?

src/curve.h:4:10: fatal error: 'gmp.h' file not found

Solution:

CFLAGS=-I`brew --prefix gmp`/include LDFLAGS=-L`brew --prefix gmp`/lib pip install ecdsa fastecdsa sympy

OpenZeppelin/nile#22 (comment)

@gmertk
gmertk / cheatsheet.sol
Created November 30, 2021 22:05 — forked from patrickd-/cheatsheet.md
Solidity – Compilable Cheatsheet
// SPDX-License-Identifier: MIT
// ^ recommended, included machine readable in bytecode metadata
// Software Package Data Exchange is an open standard
pragma solidity ^0.8.7;
// ^ floating pragma, min 0.8.7 max excluding 0.9.0
// same as complex pragma: pragma solidity >=0.8.7 <0.9.0;
// major.breakingchanges.bugfixes
// only makes the compiler check for compatibility and throws error if not matching!
// should only be floating during development, fixed everywhere during testing & deployment
import Foundation
func main() {
print("Starting")
// GCD works by dispatching chunks of code (represented by closures, and called 'blocks') onto things called 'dispatch
// queues'. These queues run the blocks, either on the main thread or in a background thread. (Queues don't correspond
// to threads on a one-to-one basis; GCD is responsible for spinning up threads to service queues.)
// Here's a variable representing shared state I want to manipulate from different threads.
enum APIError : ErrorType {
// Can't connect to the server (maybe offline?)
case ConnectionError(error: NSError)
// The server responded with a non 200 status code
case ServerError(statusCode: Int, error: NSError)
// We got no data (0 bytes) back from the server
case NoDataError
// The server response can't be converted from JSON to a Dictionary
case JSONSerializationError(error: ErrorType)
// The Argo decoding Failed
@gmertk
gmertk / Selenium Cheat Sheet.md
Last active January 8, 2019 16:11 — forked from kenrett/Selenium Cheat Sheet.md
Selenium Cheat Sheet - Ruby

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
@gmertk
gmertk / selenium-webdriver-cheatsheet.md
Last active September 13, 2015 11:20 — forked from huangzhichong/selenium-webdriver-cheatsheet.md
Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
var x: Int? = 0
// Lets me unwrap x and also check a condition on it
func fooGuard() {
guard let x = x where x > 0 else {
return
}
// Do stuff with x
x.value
@gmertk
gmertk / RangeWhileMonitorPart06.swift
Created May 27, 2015 11:18
A Simple Beacon Manager which starts/stops ranging when a beacon region transition happens.
import Foundation
import CoreLocation
let beaconManagerDidEnterRegionsNotification = "beaconManagerDidEnterRegionsNotification"
let beaconManagerDidExitRegionsNotification = "beaconManagerDidExitRegionsNotification"
let beaconManagerUserInfoEnteredRegionsKey = "enteredRegions"
let beaconManagerUserInfoExitedRegionsKey = "exitedRegions"
class BeaconManager: NSObject, CLLocationManagerDelegate {
private var manager = CLLocationManager()
@gmertk
gmertk / RangeWhileMonitorPart05.swift
Created May 27, 2015 10:00
Use sets for regions in didRangeBeacons
func locationManager(manager: CLLocationManager!, didRangeBeacons beacons: [AnyObject]!, inRegion region: CLBeaconRegion!) {
var latestRegions = Set<CLBeaconRegion>()
// Create CLBeaconRegions from CLBeacons
if let beacons = beacons as? [CLBeacon] {
for beacon in beacons {
latestRegions.insert(regionFromBeacon(beacon))
}
}