Skip to content

Instantly share code, notes, and snippets.

@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@peterprokop
peterprokop / URLRequest.swift
Last active August 29, 2022 15:40
Print NSURLRequest in cURL format (Swift 3)
//
// URLRequest.swift
//
// Created by Peter Prokop on 17/08/2017.
import Foundation
public extension URLRequest {
/// Returns a cURL command for a request
@shaps80
shaps80 / cURL+Request.swift
Last active December 23, 2023 17:43
Generates a cURL command representation of a URLRequest in Swift.
import Foundation
extension URLRequest {
/**
Returns a cURL command representation of this URL request.
*/
public var curlString: String {
guard let url = url else { return "" }
var baseCommand = #"curl "\#(url.absoluteString)""#
@aasmith
aasmith / nested-json.sh
Created September 19, 2017 21:23
How to decode nested json with jq
# Typical use-case is decoding an AWS STS message. The DecodedMessage key contains escaped JSON.
jq '.DecodedMessage | fromjson | .' message.json
@sgdan
sgdan / gzip.kts
Last active May 24, 2024 10:10
Kotlin code to compress/uncompress a string with gzip
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.StandardCharsets.UTF_8
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
fun gzip(content: String): ByteArray {
val bos = ByteArrayOutputStream()
GZIPOutputStream(bos).bufferedWriter(UTF_8).use { it.write(content) }
return bos.toByteArray()
@dalegaspi
dalegaspi / brew_symlink_error_sierra.md
Last active January 4, 2024 22:32
Homebrew Symlink errors in Mac OSX High Sierra
@atomkirk
atomkirk / parsce-csv-test.js
Last active February 13, 2023 09:19
parse csv with javascript
import parseCsv from 'zipbooks/utils/parse-csv'
import { module, test } from 'qunit'
module('Unit | Utility | parse-csv', function(_hooks) {
test('parses csv successfully', function(assert) {
let result = parseCsv('name,age\nadam,31\ntim,32\n"St, clair",26')
assert.equal(JSON.stringify(result), '[["name","age"],["adam","31"],["tim","32"],["St, clair","26"]]')
})
@guness
guness / CombinedLiveData.java
Last active May 15, 2023 14:10
LiveData merger that takes two live data inputs and a merger function. Merges two results using merger function, and returning result allowing null inputs and outputs. Input and out types are parametric. However only supports two live data inputs for now.
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.Observer;
import java.util.function.BiFunction;
public class CombinedLiveData<T, K, S> extends MediatorLiveData<S> {
@krunk4ever
krunk4ever / GooglePay.kt
Last active May 21, 2020 17:28
PaymentDataRequest support for Google Pay API v2 on Android
import android.os.Bundle
import com.google.android.gms.wallet.PaymentData
import com.google.android.gms.wallet.PaymentDataRequest
import com.google.android.gms.wallet.PaymentMethodTokenizationParameters
import com.google.android.gms.wallet.WalletConstants
import org.json.JSONArray
import org.json.JSONObject
/**
* Google Pay API request configurations.
@SavageCore
SavageCore / 1-readme.md
Last active June 25, 2024 18:31 — forked from cdleveille/Install⁄Update Xone
Install or update xone driver for Steam Deck (desktop shortcut and bash script)

Enjoying this script? Consider buying me a beer/coffee!

ko-fi

First time setting up your Deck? You may enjoy my setup guide. It'll get you started on Emulation.

Improvements

Main changes at initial release versus cdleveille's original script:

  • Added zenity for a basic "GUI"