Skip to content

Instantly share code, notes, and snippets.

View icy's full-sized avatar
🐓
Available

Ky-Anh Huynh icy

🐓
Available
View GitHub Profile
@sciurius
sciurius / btsync-keygen
Created May 2, 2014 13:40
Perl script to generate secrets and config data for BTsync
#!/usr/bin/perl -w
# Key generation for BTsync.
# Author : Johan Vromans
# Created On : Sun Apr 27 20:31:57 2014
# Last Modified By: Johan Vromans
# Last Modified On: Fri May 2 15:37:24 2014
# Update Count : 47
# Status : Unknown, Use with caution!
@joech4n
joech4n / change-ownership.lambda.md
Last active February 11, 2018 04:20
AWS Lambda Function to change ownership on each object created to the bucket owner. It accomplishes this by overwriting the key with itself. This is to be triggered by an S3 ObjectCreated (All) Event.
@tomasinouk
tomasinouk / snat_dnat_advantech.md
Last active May 29, 2024 18:17
examples of SNAT, DNAT with iptables for Advantech, Conel routers, with comments (probably will work on other routers where iptables can be manipulated, care needs to be taken on applying these commands after reboot).

Some examples of SNAT, DNAT with iptables with comments

mainly used in start-up script

How to test 'safely'

When we play with iptables aka firewall we might end up in situation, where we execute rule, which has unforseen impact - lock yourself out. Recovering from this situation is necessity.

How to:

  • Enable reboot via SMS.
  • Test all commands in shell first before putting them into Start-up script. This way the command will be wiped out, when unit is rebooted.

masquarade all outgoing packets to be WLAN0 IP

@icy
icy / gist:703eb4e362088b53f1e8
Last active September 20, 2016 02:32
See how nginx includes its files
#!/bin/bash
# Purpose:
# See how nginx loads/includes its configuration files
# Very useful to detect quickly where there errors come from.
# Author : Anh K. Huynh
# Date : 2015 Aug 14th
# License: MIT
# Notes :
# Some system has a different level. Here it's 3.
@icy
icy / expand.rb.md
Last active March 6, 2019 14:20
Bash-liked Curly Brace Expansion in ruby

System-call method

Use Bash to expand the brace. If you don't like this, you may look at more professional way at https://gist.github.com/ewoodh2o/3829405 This method invokes a system call to ask Bash to expand.

FIXME: This is not secure!!!

class String
@icy
icy / gist:30977d7d9ad6275ae560
Last active March 8, 2016 13:48 — forked from CrookedNumber/gist:8856939
How to create Trello Cards from the Command Line (with a ~10 minute set-up)
  1. This is quick and dirty and not terribly maintainable. But it's very useful for creating quick cards from the terminal. Requires familiarity with Trello and a basic understanding of bash.
  2. Log-in to Trello.
  3. Go to: https://trello.com/1/appKey/generate
  4. Make note of your key. Replace any mention of YourTrelloKey with this hash.
  5. Create a token. Go to https://trello.com/1/authorize?key=YourTrelloKey&name=SimpleBASHScript&expiration=never&response_type=token&scope=read,write in your browser and follow directions.
  6. Make note of the token. Replace any mention of YourTrelloToken with this looong hash.
  7. Pick a reasonable number of the most popular boards you use. Grab the URLs of those boards. At the same time, think of short, one-word, easy-to-remember names for each board (e.g., work, homeprojects, wedding).
  8. Grab the board IDs of the boards you chose. It'll be the ~8 character hash-like string in the URL. E.g., for https://trello.com/b/aWsGTrsD/work the ID is aWsGTrsD
  9. One by one, plug thos
@tamas-molnar
tamas-molnar / kubectl-shortcuts.sh
Last active May 30, 2024 15:50
aliases and shortcuts for kubectl
alias kc='kubectl'
alias kclf='kubectl logs --tail=200 -f'
alias kcgs='kubectl get service -o wide'
alias kcgd='kubectl get deployment -o wide'
alias kcgp='kubectl get pod -o wide'
alias kcgn='kubectl get node -o wide'
alias kcdp='kubectl describe pod'
alias kcds='kubectl describe service'
alias kcdd='kubectl describe deployment'
alias kcdf='kubectl delete -f'
@williamtsoi1
williamtsoi1 / lake-s3-object-take-ownership.js
Last active September 1, 2020 07:48
a lambda function to automatically take ownership of any objects written into an s3 bucket. Inspired by https://gist.github.com/joech4n/953c1cd6a36698c5d120
console.log('Loading event');
var aws = require('aws-sdk');
var s3 = new aws.S3({apiVersion: '2006-03-01'});
var sqs = new aws.SQS({apiVersion: '2012-11-05'});
exports.handler = function(event, context, callback) {
s3.listBuckets(function(err,data) {
if (err) {
console.log('ERROR: Problem getting list of buckets. This should have something to do with incorrect IAM permissions for the lambda.');
errorMessage = 'ERROR: Error from S3: '+err;
@StevenACoffman
StevenACoffman / _MicroService Proxy Gateway Solutions.md
Last active September 28, 2023 14:54
Microservice Proxy/Gateway Solutions

MicroService Proxy Gateway Solutions

Kong, Traefik, Caddy, Linkerd, Fabio, Vulcand, and Netflix Zuul seem to be the most common in microservice proxy/gateway solutions. Kubernetes Ingress is often a simple Ngnix, which is difficult to separate the popularity from other things.

Github Star Trend:

Github Star History for Kong vs traefik vs fabio vs caddy vs Zuul

This is just a picture of this link from March 2, 2019

Originally, I had included some other solution

@firatkucuk
firatkucuk / delete-slack-messages.js
Last active May 1, 2024 04:17
Deletes slack public/private channel messages, private chat messages and channel thread replies.
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = 'SLACK TOKEN';
// Legacy tokens are no more supported.
// Please create an app or use an existing Slack App