Skip to content

Instantly share code, notes, and snippets.

View andreineculau's full-sized avatar
:bowtie:

Andrei Neculau andreineculau

:bowtie:
View GitHub Profile
@huytd
huytd / wordle.md
Last active March 17, 2024 20:51
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@dguerri
dguerri / qnap-clientenc-decrypt.sh
Last active September 25, 2023 09:01
Quick shell script to decrypt client-side encrypted file using QNAP HBS *Sync* jobs. Only work with version 2 files - Doesn't work with QNAP HBS Backup jobs!
#!/bin/sh
set -ue
[ "$#" -lt 2 ] && { echo "Syntax: $0 <filename> <key>"; exit 1; }
filename="$1"
key="$2"
# Compose the key by repeating the user input until we have 32 characters (64 hex digits)
@andreineculau
andreineculau / Andrei.bttpreset.json
Last active July 14, 2020 23:48
Minimalist BetterTouchTool preset
{
"BTTPresetName" : "Andrei",
"BTTPresetColor" : "77.201250, 220.575000, 158.446375, 255.000000",
"BTTGeneralSettings" : {
"BTTPathSampleSize" : 100,
"BTTHTTPServerPort" : 12345,
"BTTCMOnTop" : true,
"ctrlDisables" : false,
"BTTForceForceClickPressure2F" : 700,
"BSTLeftHalfBlock" : true,
@madjo
madjo / converter.py
Created October 28, 2019 15:55
Convert {parquet | orc} to json and orc to parquet
#! /usr/bin/env python
import pandas as pd
import argparse
import os
import pyarrow.orc as orc
# usage: ./converter.py --help
CONVERTERS = ['parquet2json', 'orc2json', 'orc2parquet']
@andresriancho
andresriancho / get-display-name.py
Last active December 5, 2023 13:29
Get AWS root account email address
import boto3
session = boto3.Session(profile_name='ariancho')
s3_client = session.client('s3')
display_name = s3_client.list_buckets()['Owner']['DisplayName']
print(display_name)
for bucket in s3_client.list_buckets()['Buckets']:
print(s3_client.get_bucket_acl(Bucket=bucket['Name'])['Owner']['DisplayName'])
@awerlang
awerlang / lambda.js
Created April 7, 2018 18:18
aws lambda node.js
'use strict';
var net = require('net');
var repl = require('repl');
var util = require('util');
var awslambda = require('./build/Release/awslambda');
const BASE_CONTEXT = Object.freeze({
logGroupName : process.env['AWS_LAMBDA_LOG_GROUP_NAME'],
logStreamName : process.env['AWS_LAMBDA_LOG_STREAM_NAME'],
functionName : process.env['AWS_LAMBDA_FUNCTION_NAME'],
#!/usr/bin/env bash
# Map Caps Lock key to Left Control key
# https://developer.apple.com/library/content/technotes/tn2450/_index.html
# This doesnt work. Reverts on restart
# hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0}]}'
# References:
# https://github.com/mathiasbynens/dotfiles/issues/310
# https://gist.github.com/scottstanfield/0f8ce63271bebfb5cf2bb91e72c71f91
# The last link didnt work for me on Sierra or High Sierra. I could not find IOHIDKeyboard but
@andreineculau
andreineculau / sendmail.app
Last active February 2, 2018 16:41 — forked from masnick/gist:6985205
a nice way to send mail from the shell in osx
#!/usr/bin/env osascript
# usage: sendmail.app from@me.com to@you.com,and@you.com "have you seen this?" "a nice way to send mail/attachment from the shell in osx (if you have configured Mail.app) https://gist.github.com/andreineculau/38f6160cc9aa11956953"
on theSplit(theString, theDelimiter)
-- save delimiters to restore old settings
set oldDelimiters to AppleScript's text item delimiters
-- set delimiters to delimiter to be used
set AppleScript's text item delimiters to theDelimiter
-- create the array
@si14
si14 / dags.md
Last active October 23, 2015 14:55
  1. for "missing?" we often need to query database to check if an item exists. If predicates are truly independent, we will need to do the query again to return the item.
  2. "data flow" looks something like this (in Prismatic's Graph lib):
(def stats-graph
  {:n  (fnk [xs]   (count xs))
   :m  (fnk [xs n] (/ (sum identity xs) n))
   :m2 (fnk [xs n] (/ (sum #(* % %) xs) n))
   :v  (fnk [m m2] (- m2 (* m m)))})
@essen
essen / http_specs.md
Last active January 10, 2022 02:01
HTTP and related specifications