Skip to content

Instantly share code, notes, and snippets.

View arunvelsriram's full-sized avatar
🇮🇳
👨‍💻 from 🏠

Arunvel Sriram arunvelsriram

🇮🇳
👨‍💻 from 🏠
View GitHub Profile
@prasann
prasann / leave-updater.gs
Last active November 13, 2021 15:28
Updates the calendar with a day long event when someone applies leave in leave planner
const leaveTag = "label-to-which-the-emails-are-marked";
const calendarId = "new-calendar-id";
const nameRegEx = /Leave plan for (?<name>.*) is as below/;
const leaveTypeRegEx = /Leave Type:\s*(?<type>(.)*)?/;
const startDateRegEx = /Start Date:\s*(?<leave>(?:.*)202.)(?:,\s)*(?:(Half-Day:\s*(.*)))?/;
const endDateRegEx = /End Date:\s*(?<leave>(?:.*)202.)(?:,\s)*(?:(Half-Day:\s*(.*)))?/;
function applyRegEx(regEx, key, messageBody){
const matches = regEx.exec(messageBody);
return matches?.groups && matches.groups[key] ? matches.groups[key] : undefined;
@rmoff
rmoff / gist:cfa93f2d8b722f4e6bf96aedec5074ef
Created January 22, 2020 17:34
InfluxDB Sink connector example
kafkacat -b localhost:9092 -P -t testdata-json4 <<EOF
{ "schema": { "type": "struct", "fields": [ { "type": "map", "keys": { "type": "string", "optional": false }, "values": { "type": "string", "optional": false }, "optional": false, "field": "tags" }, { "field": "sn", "optional": false, "type": "string" }, { "field": "value", "optional": false, "type": "float" } ], "optional": false, "version": 1 }, "payload": { "tags": { "tagnum": "5" }, "sn": "FOO", "value": 500.0 } }
EOF
curl -i -X PUT -H "Accept:application/json" \
-H "Content-Type:application/json" http://localhost:8083/connectors/SINK_INFLUX_01/config \
-d '{
"connector.class" : "io.confluent.influxdb.InfluxDBSinkConnector",
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable": "true",
@xxxxlr
xxxxlr / React-Native-WebView-Cookies.js
Created July 27, 2017 01:10 — forked from kanzitelli/React-Native-WebView-Cookies.js
React Native Trick: Get Cookies of WebView without using any native modules such as react-native-cookies. Might be helpful for getting JWT while making OAuth2 👽
// @flow
import React, { Component } from 'react';
import {
WebView,
} from 'react-native';
class LoginScreen extends Component {
state = {
cookies : {},
@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@lujiacn
lujiacn / gist:520e3e8abfd1c1b39c30399222766ee8
Last active November 8, 2023 18:04
vundle work with neovim

after install neovim nvim config file folder ~/.config/nvim

$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.config/nvim/bundle/Vundle.vim

set nocompatible              " be iMproved, required
filetype off                  " required
" set the runtime path to include Vundle and initialize

set rtp+=~/.vim/bundle/Vundle.vim

@justincampbell
justincampbell / How-to-Win-Friends-and-Influence-People.md
Created September 19, 2013 17:11
Principles of How to Win Friends and Influence People

How to Win Friends and Influence People

Fundamental Techniques in Handling People

  1. Don't criticize, condemn, or complain.
  2. Give honest and sincere appreciation.
  3. Arouse in the other person an eager want.
  4. Never show others that you are not interested in what they have to say.
@speeddragon
speeddragon / kali-linux-wl-fix.sh
Last active February 18, 2024 13:05
Kali Linux fix for "modprobe: FATAL: Module wl not found"
# Update and install necessary packages
apt-get update
apt-get install linux-image-$(uname -r|sed 's,[^-]*-[^-]*-,,') linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')
# Download some extra packages, that do the trick for "wl module not found"
wget http://http.kali.org/kali/pool/main/l/linux-tools/linux-kbuild-4.3_4.3.1-2kali1_amd64.deb
wget http://http.kali.org/kali/pool/main/l/linux/linux-headers-4.3.0-kali1-common_4.3.3-5kali4_amd64.deb
wget http://http.kali.org/kali/pool/main/l/linux/linux-headers-4.3.0-kali1-amd64_4.3.3-5kali4_amd64.deb
# Install with correct order
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

tldr: go build only produces an executable for main packages. Check the package name of your main file is main.

I am an idiot. Its only through mistakes that you learn tho. I have recently been running into issues with my new golang projects. ONLY the new ones. Whenever I try to make a new project, it would always have issues. The biggest issue is the fact that "go build" would not produce an executable without "-o main.exe" as arguments. When an executable was produced, if I ran it I got

$ ./main.exe
./main.exe: line 1: syntax error near unexpected token \`newline\'
./main.exe: line 1: \`!<arch>\'
@tristanfisher
tristanfisher / Ansible-Vault how-to.md
Last active April 3, 2024 13:55
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

Working with ansible-vault


I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.