Skip to content

Instantly share code, notes, and snippets.

View gudata's full-sized avatar
🏢
Working from office

gudata

🏢
Working from office
View GitHub Profile
@gudata
gudata / WireGuard_Setup.txt
Created December 16, 2021 17:59 — 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
@gudata
gudata / postgresql-set-id-seq.sql
Created March 31, 2021 16:22 — forked from henriquemenezes/postgresql-set-id-seq.sql
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@gudata
gudata / apigateway-dynamo_serverless.yml
Created November 25, 2020 14:50 — forked from chris/apigateway-dynamo_serverless.yml
Serverless Framework config file for creating API Gateway to DynamoDB proxy
service: my-api
org: CompanyName
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"
frameworkVersion: '>=2.1.1 <3.0.0'
custom:
defaultStage: dev
@gudata
gudata / mongo_backup.sh
Created September 25, 2019 08:51 — forked from sheharyarn/mongo_backup.sh
Mongodump Shell Script for Cronjob
#!/bin/bash
MONGO_DATABASE="your_db_name"
APP_NAME="mongo18"
MONGO_HOST="172.19.0.2"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/opt/mongo-backup/backups/$APP_NAME"
@gudata
gudata / ns-inet.sh
Created May 19, 2019 16:13 — forked from adohe-zz/ns-inet.sh
Setup a network namespace with Internet access
#!/usr/bin/env bash
set -x
NS="ns1"
VETH="veth1"
VPEER="vpeer1"
VETH_ADDR="10.200.1.1"
VPEER_ADDR="10.200.1.2"
@gudata
gudata / singleton.go
Created May 19, 2019 16:12 — forked from adohe-zz/singleton.go
Golang singleton implementation
package singleton
import (
"sync"
)
type singleton struct {
}
var instance *singleton
@gudata
gudata / ember-cli-deploy.png
Created August 22, 2017 12:38 — forked from kpfefferle/ember-cli-deploy.png
Deployment Options for Ember with Rails
ember-cli-deploy.png
@gudata
gudata / gist:e623699030b722d11b7f84b050ac8d8d
Created May 19, 2017 14:43 — forked from alphazo/gist:3303282
Clone MiFare cards using chinesse UUID writable cards

libnfc supports UUID writable cards and even has some dedicated tools for them.

However it doesn't work with some of the cards found on eBay that are even simpler to use. Sector 0 is unlocked and can be written without any additional commands. libnfc requires a small patch to get it working.

Following has been tested under ArchLinux with modified libnfc 1.5.1, mfoc 0.10.2 and a SCL3711 dongle.

Patch & recompile libnfc

The patch is fairly simple, open libnfc-1.5.1/utils/nfc-mfclassic.c and comment 2 lines (it was lines 384 and 385 for me):

// Try to write the trailer

@gudata
gudata / discover_s3
Created March 1, 2017 09:33 — forked from yokota-shinsuke/discover_s3
Monitor S3 with Zabbix
#!/usr/bin/ruby
require 'rubygems'
require 'aws-sdk'
require 'optparse'
require 'json'
discovery = {'data' => []}
s3 = AWS::S3.new
s3.buckets.each do |bucket|