Skip to content

Instantly share code, notes, and snippets.

@ramondeklein
ramondeklein / CreateCaCert.ps1
Last active August 25, 2022 17:18
Script to generate ca-cert.crt file based on the Windows Certificate store
# This script can be used to generate a ca-cert.crt file that can be used by
# Unix-based utilities like curl, git, ...
#
# It allows you to synchronize the root certificates (CA) based on the
# certificates installed in your Windows certification stores. You can also
# get a list from Mozilla, but I think it's convenient to have the same CA
# certificates in all tools.
#
# Some examples on how to use this script:
#
@acamino
acamino / HttpClientApproach.cs
Last active May 25, 2024 20:52
4 Ways to Parse a JSON API with C#
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
namespace HttpClientApproach
{
internal class Contributor
{
public string Login { get; set; }
#!/bin/bash
while [[ $# -gt 1 ]]
do
case "$1" in
-f | --file)
file="$2"
shift 2
;;
-h | --hostname)
@chinshr
chinshr / Jenkinsfile
Last active October 16, 2023 09:25
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@jpetitcolas
jpetitcolas / parsing-binary-file.go
Last active July 27, 2020 12:40
How to parse a binary file in Go? Snippet based on MoPaQ SC2 replay parsing. Related blog post: http://www.jonathan-petitcolas.com/2014/09/25/parsing-binary-files-in-go.html
package main
import (
"bytes"
"encoding/binary"
"fmt"
"log"
"os"
)
@lpf23
lpf23 / CNTLM Proxy - Centos
Last active May 11, 2022 08:29
Configure CNTLM Proxy on Centos/Ubuntu
1) Download cntlm rpm package from http://sourceforge.net/projects/cntlm/files/cntlm/
2) Login as root
3) Run command:
$ rpm -ivh cntlm-*.rpm
4a) Obtain password hash for the configuration file in step 4b (do not put plaintext password in configuration)
$ cntlm -H -d <domain> -u <username>
@mziwisky
mziwisky / Oauth2.md
Last active February 15, 2024 23:31
Oauth2 Explanation

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.

@dysinger
dysinger / idris-ubuntu-12.04.md
Last active August 29, 2015 13:56
Install Idris (latest) on Ubuntu 12.04

Install GHC & Cabal-Install

apt-get update
apt-get install -y zlib1g-dev libncurses5-dev ghc cabal-install happy alex

Update Cabal-Install

cabal update
cabal install cabal-install

export PATH=$HOME/.cabal/bin:./.cabal-sandbox/bin:$PATH

@chreekat
chreekat / gist:5965830
Last active December 19, 2015 13:59
QuickCheck'ing values in Template Haskell's Q monad.
{-# LANGUAGE TemplateHaskell #-}
-- An example of testing TH-generated thingadoohickies.
--
-- Using the standard QuickCheck module, there is no direct way to test
-- values generated with Template Haskell functions, most of which end up
-- in the Q monad. This little writeup describes how to test those values
-- using the module Test.QuickCheck.Monadic.
--
-- For this example, you can ignore the doohickies being generated. I just
@egonSchiele
egonSchiele / reader.hs
Created June 10, 2013 20:51
Reader monad example
import Control.Monad.Reader
hello :: Reader String String
hello = do
name <- ask
return ("hello, " ++ name ++ "!")
bye :: Reader String String
bye = do
name <- ask