Skip to content

Instantly share code, notes, and snippets.

@kaich1n
kaich1n / vue-axios-cors.md
Created June 16, 2021 04:48 — forked from brenopolanski/vue-axios-cors.md
Vue.js + Axios + CORS

Proxy requests using Webpack dev server to avoid cors in development mode.

In your webpack.config file add:

"devServer":{
  "proxy": {
    "/api": {
    "target": 'https://my-target.com',
    "pathRewrite": { '^/api': '' },
@kaich1n
kaich1n / gitproxy-socat
Created March 12, 2021 12:34 — forked from sit/gitproxy-socat
A simple wrapper around socat to use as a git proxy command
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny
@kaich1n
kaich1n / go_cross_compile
Last active August 15, 2019 09:09
Go compile compile
//list all supported platforms
go tool dist list
GOOS=linux GOARCH=arm64 go build -o hello-arm64
// use softfloat for mips soc
GOOS=linux GOARCH=mips GOMIPS=softfloat go build -o hello-mips
// optimized for size
GOOS=linux GOARCH=mips GOMIPS=softfloat go build -ldflags="-s -w" -o hello-mips-stripped
1. Execute make first. This will result in a netlinkKernel.ko output among many others.
2. Execute $ gcc netlinkUser.c -o netlinkUser
3. Insert kernel module by :$ sudo insmod netlinkKernel.ko
4. Run ./netlinkUser to see message and run dmesg to see debug messages
5. Remove module by : $ sudo rmmod netlinkKernel
6. Finally make clean to remove output files.
@kaich1n
kaich1n / cond.c
Created June 4, 2019 06:37 — forked from rtv/cond.c
An example of using pthread's condition variables, showing how to block a main thread while waiting for worker threads to finish their work, without joining the threads. This could be useful if you want to loop the threads, for example.
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
/* Compile like this:
gcc --std=c99 -lpthread cond.c -o cond
@kaich1n
kaich1n / docker-compose.yml
Created August 30, 2018 14:17 — forked from barnybug/docker-compose.yml
Docker compose for a Docker-in-docker gitlab runners setup
# Docker-in-Docker Gitlab runners setup taken from:
# https://medium.com/@tonywooster/docker-in-docker-in-gitlab-runners-220caeb708ca
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:17.09.0-ce-dind
command:
- --storage-driver=overlay2