Skip to content

Instantly share code, notes, and snippets.

@nkavian
nkavian / locking.swift
Created August 12, 2019 21:55 — forked from kristopherjohnson/locking.swift
Simple synchronization functions for Swift, wrapping the Cocoa NSLocking classes
import Foundation
/// Protocol for NSLocking objects that also provide tryLock()
public protocol TryLockable: NSLocking {
func tryLock() -> Bool
}
// These Cocoa classes have tryLock()
extension NSLock: TryLockable {}
extension NSRecursiveLock: TryLockable {}
FROM debian:sid-slim
ADD jdk-10-ea+39_linux-x64_bin.tar.gz /java
ENTRYPOINT ["/java/jdk-10/bin/jshell", "-q"]
@nkavian
nkavian / AndroidManifest.xml
Created September 30, 2017 22:31 — forked from takeshiyako2/AndroidManifest.xml
Android Sample YouTube API on the Fragment
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxxx.xxxx.xxxx.fragmentdeyoutube" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@nkavian
nkavian / snarktest.solidity
Created September 21, 2017 04:23 — forked from chriseth/snarktest.solidity
zkSNARKs test code
pragma solidity ^0.4.14;
library Pairing {
struct G1Point {
uint X;
uint Y;
}
// Encoding of field elements is: X[0] * z + X[1]
struct G2Point {
uint[2] X;
function (doc, meta) {
var jsonld={};jsonld.compact=function(input,ctx){var options={};var callbackArg=2;if(arguments.length>3){options=arguments[2]||{};callbackArg+=1}var callback=arguments[callbackArg];if(input===null){return callback(null,null)}if(!('base'in options)){options.base=''}if(!('strict'in options)){options.strict=true}if(!('optimize'in options)){options.optimize=false}if(!('graph'in options)){options.graph=false}if(!('resolver'in options)){options.resolver=jsonld.urlResolver}jsonld.expand(input,options,function(err,expanded){if(err){return callback(new JsonLdError('Could not expand input before compaction.','jsonld.CompactError',{cause:err}))}var activeCtx=_getInitialContext();jsonld.processContext(activeCtx,ctx,options,function(err,activeCtx){if(err){return callback(new JsonLdError('Could not process context before compaction.','jsonld.CompactError',{cause:err}))}try{if(options.optimize){options.optimizeCtx={}}input=expanded;var compacted=new Processor().compact(activeCtx,null,input,option
#! /bin/bash
# Kill processes orphaned by Jenkins
# Work around Java's use of SIGTERM rather than SIGKILL and
# Jenkins's lack of any workaroud in the box.
# here is the relevant bug:
# https://issues.jenkins-ci.org/browse/JENKINS-17116
# Suggested usage:
@nkavian
nkavian / nginx.conf
Last active August 29, 2015 14:13 — forked from plentz/nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

Install command line tools:

then run this:

git config --global diff.tool bc3
git config --global difftool.bc3 trustExitCode true
git config --global merge.tool bc3