Skip to content

Instantly share code, notes, and snippets.

View asjustas's full-sized avatar

Justas asjustas

  • Vilnius, Lietuva
View GitHub Profile
@asjustas
asjustas / http_proxy.go
Created June 20, 2024 12:25 — forked from afdalwahyu/http_proxy.go
golang http proxy server CONNECT method
package main
import (
"bufio"
"encoding/base64"
"flag"
"io"
"io/ioutil"
"log"
"net"

Problem

The go command line tool needs to be able to fetch dependencies from your private GitLab, but authenticaiton is required.

This assumes your private GitLab is hosted at privategitlab.company.com.

Environment variables

The following environment variables are recommended:

export GO111MODULE=on
export GOPRIVATE=privategitlab.company.com
@asjustas
asjustas / WireGuard_Setup.txt
Created May 10, 2020 18:02 — forked from chrisswanda/WireGuard_Setup.txt
Stupid simple setting up WireGuard - Server and multiple peers
Install WireGuard via whatever package manager you use. For me, I use apt.
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
MacOS
$ brew install wireguard-tools
Generate key your key pairs. The key pairs are just that, key pairs. They can be
@asjustas
asjustas / GPG and git on macOS.md
Created February 21, 2018 08:34 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@asjustas
asjustas / xdebug_settings.ini
Created February 5, 2018 20:26 — forked from drobinson/xdebug_settings.ini
Xdebug settings for debugging using remote hosts and how to debug cli php scripts
zend_extension = /usr/lib/php5/20121212/xdebug.so
[xdebug]
; This is the default, but just to be sure...
xdebug.remote_port = 9000
; Make sure vmhost is set in /etc/hosts as the ip address of your host machine
; from your virtual machine (set in virtual box as the host-only adapter ip)
@asjustas
asjustas / README.md
Created December 7, 2017 13:37 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
var errorLog = function errorLog(msg, url, line) {
var i = document.createElement('img');
i.src = '/error/log?msg=' + encodeURIComponent(msg) + '&url=' + encodeURIComponent(url) + '&line=' + encodeURIComponent(line);
};
window.onerror = errorLog;
@asjustas
asjustas / redis-counters.js
Created April 20, 2012 21:04 — forked from dvbportal/redis-counters.js
Storing Counters In Redis
// Additional code in node-http-proxy.js
var crypto = require('crypto');
var redis = require('redis');
var client = redis.createClient(config.opt.redis_port, 'cloudno.de');
client.auth(config.opt.redis_auth, function(result) {
util.log("Redis authenticated.");
})
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal